python - 为什么 setup.py 保留在我的分发包中?

标签 python distutils

我对 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/

相关文章:

python - distutils 到底做了什么?

c++ - 你如何让 python 识别读取预编译的共享文件?

python - 我应该将 C 库与我的 Python 应用程序捆绑在一起吗?

python - 选择 `distutils.setup(...)` 中的 Visual Studio 版本

python - python中的lambda可以迭代dict吗?

python - 如何在 Python 中将列表字典格式化为表格?

python - Webassets - 排除 bundle 中的文件

python - 如何让 Blender 导出器脚本从命令行运行?

python - 我无法使用 iPython 将我的 json 文件作为 "pretty"JSON

python - 如何使用 python 包分发数据文件以使其可读?