python - 关于 bdist 目录层次结构的问题

标签 python distutils

我刚刚制作了一个小应用程序,然后为其编写了一个 setup.py 文件。一切似乎都正常,除了我想不出一件小事。

bdist 选项传递给 setup.py 时,它会创建存档 gzip 压缩的 tar 文件。当我打开该文件时,我注意到目录结构是:

> usr
  > lib
    > python2.6
      > site-packages 
        > Folder 1
        > Folder 2

这是什么原因?通常,我希望文件夹 1 和文件夹 2 位于根目录中。为什么 bdist 添加顶级目录?有什么办法可以摆脱它们(更重要的是,我应该摆脱它们吗?)

最佳答案

我想你想要一个 sdist 输出....所以试试 python setup.py sdist

Python 文档引用

As a simple example, if I run the following command in the Distutils source tree:

python setup.py bdist

then the Distutils builds my module distribution (the Distutils itself in this case), does a “fake” installation (also in the build directory), and creates the default type of built distribution for my platform. The default format for built distributions is a “dumb” tar file on Unix, and a simple executable installer on Windows. (That tar file is considered “dumb” because it has to be unpacked in a specific location to work.)

参见 Python Documentation

关于python - 关于 bdist 目录层次结构的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3483243/

相关文章:

python - Python 包是否可以依赖于另一个 Python 包的特定版本控制修订版?

python - 在 Python distutils 中从 setup.py 查找脚本目录的正确方法?

python - 在python中创建用户定义类的对象集

python - 绘制具有多个标签的混淆矩阵 sklearn

python - pandas 列值和变量值字符串连接

python3 setup.py 安装失败(RHEL 8)

python setup.py develop 覆盖已安装的版本

python - GCP 上的 Tensorflow 模型 - 将 JSON 预测请求转换为正确的模型输入

Python - 'call' 一个类