发布于 2019-04-17 21:36:16
免责声明
尽管在技术上是可能的,但请注意,当源dist不包含文件和轮转时,您最终会为相同的元数据安装不同的包,这是一种不良行为。在下面的例子中,
$ pip install spam --only-binary=spam # force installation from wheel将安装file.txt
$ pip show -f spam | grep file.txt
spam/file.txt而
$ pip install spam --no-binary=spam # force installation from source dist不会的。这是一个引入新错误的明确来源,任何用户都不会对您的这一决定表示感谢。
如果您确实确定这是您所需要的:您可以在MANIFEST.in中排除该文件。示例:
project
├── spam
│ ├── __init__.py
│ └── file.txt
├── MANIFEST.in
└── setup.pyMANIFEST.in
exclude spam/file.txtsetup.py
from setuptools import setup
setup(
name='spam',
version='0.1',
packages=['spam'],
package_data={'spam': ['file.txt']},
)建筑车轮:
$ python setup.py bdist_wheel >/dev/null 2>&1 && unzip -l dist/spam-*.whl | grep file.txt
0 04-17-2019 21:25 spam/file.txt建筑资料来源区:
$ python setup.py sdist --formats=zip >/dev/null 2>&1 && unzip -l dist/spam-*.zip | grep file.txt
<empty>https://stackoverflow.com/questions/55714083
复制相似问题