【问题标题】:Difference between building distribution packages with python3 and python2?使用 python3 和 python2 构建分发包之间的区别?
【发布时间】:2018-06-19 14:50:08
【问题描述】:

我正在尝试使用 doc 构建 python 包

我有几个问题

  1. 使用 python2 和 python3 的工具(setuptools 和 wheel)生成的 wheel 包有什么不同吗?

  2. python3 setup.py bdist_wheel 生成的包是否与python2兼容,反之亦然(假设源代码与两个版本兼容)。

【问题讨论】:

    标签: python python-3.x setuptools python-wheel


    【解决方案1】:

    使用工具(setuptools 和 wheel)与 python2 和 python3 生成的轮子包有什么区别。

    由于 zip 压缩算法的不同,可能存在一些字节对字节的差异,但没有任何意义的差异,除了...

    python3 setup.py bdist_wheel 生成的包是否与python2兼容,反之亦然(假设源代码兼容两个版本)。

    默认情况下,使用 Python 2 构建的轮子仅对 Python 2 有效,使用 Python 3 构建的轮子仅对 Python 3 有效。这可以通过将以下内容添加到项目的 setup.cfg 文件中来更改:

    [bdist_wheel]
    universal = 1
    

    添加此选项后,生成的轮子将是“通用的”,与 Python 2 和 Python 3 兼容。

    【讨论】:

    • universal=1 选项可用于 python2 和 python3 吗?
    猜你喜欢
    • 1970-01-01
    • 2015-06-13
    • 1970-01-01
    • 2021-10-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-14
    • 2022-10-04
    相关资源
    最近更新 更多