我对 Python 有点陌生,甚至对 distutils 也比较陌生。
我想为我办公室的其他用户创建我的程序的发行版,因此我使用了 distutils.core 中的安装程序。我设置了目录结构,创建了一个 manifest.in 文件和一个 setup.py 文件。一切似乎都按计划进行。结果是我有一个 .zip 文件,其中包含我想要的目录结构。
maifest 文件不包含在 .zip 文件中(我假设只有 distutils 需要它),但 setup.py 文件保留在 .zip 文件中。这是为什么?最终用户需要 setup.py 吗?
谢谢,
-RS
最佳答案
在正常情况下,用户通过运行 python setup.py install
或有效执行相同操作的操作(例如 pip install foo
)来安装您的应用。
当然,在某些情况下他们不需要 setup.py
- 例如,因为他们正在安装预打包的二进制 Egg 或 Windows 安装程序或其他任何东西 - 但大多数软件包都必须工作对于正常情况。因此,默认的打包命令包含它。在文档中,Specifying the files to distribute说:
If you don’t supply an explicit list of files (or instructions on how to generate one), the sdist command puts a minimal default set into the source distribution:
…
setup.py
(or whatever you called your setup script) …
关于python - 为什么 setup.py 保留在我的分发包中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15209446/