[英]how to exclude source code from bdist_wheel python
我们想从我们创建的包中排除 Python 源代码。 但是在配置setup.py
,我未能排除 py 文件。 我一直在使用python setup.py bdist_wheel
作为命令。 有没有办法从 Python 包中排除源代码? 基本上我们不想暴露源代码。
该轮插件setuptools
来处理bdist_wheel
没有--exclude_source_files
仅受支持bdist_egg
。 然而, egg
包已被弃用,例如pip
不支持。 但是,您可以做什么:
pip3 install wheel
python3 setup.py bdist_egg --exclude-source-files
wheel convert dist/mypackage-1.0-py3.6.egg
wheel
实用程序获取一个源代码剥离的egg
并将其转换为whl
包。
这让我们把 Python 库放在一个可用内存非常少的嵌入式系统上。
可以通过以下方式实现:
./setup.py bdist_egg --exclude_source_files
适用于 distutils 和 setuptools。
嗯,我们也遇到了这个问题(大约 2 年前),但没有找到合理的自动化流程。 所以我写了我自己的。
欢迎使用:setup.py 模板
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.