简体   繁体   English

用python3和python2构建发行包之间的区别?

[英]Difference between building distribution packages with python3 and python2?

I am trying to build python packages using this doc 我正在尝试使用此文档构建python软件包

I have couple of questions 我有几个问题

  1. Is there any difference in wheel packages generated using tools(setuptools and wheel) with python2 versus python3. 使用python2和python3的工具(setuptools和wheel)生成的wheel包是否有任何区别。

  2. Are packages generated by python3 setup.py bdist_wheel compatible with python2 and vice versa (assuming the source code is compatible with both versions). python3 setup.py bdist_wheel生成的包是否与python2兼容,反之亦然(假设源代码与两个版本都兼容)。

Is there any difference in wheel packages generated using tools(setuptools and wheel) with python2 versus python3. 使用python2和python3的工具(setuptools和wheel)生成的wheel包是否有任何区别。

There may be some byte-for-byte differences due to differing zip compression algorithms, but there is no meaningful difference, except... 由于不同的zip压缩算法,可能会有逐字节的差异,但是没有有意义的差异,除了...

Are packages generated by python3 setup.py bdist_wheel compatible with python2 and vice versa (assuming the source code is compatible with both versions). python3 setup.py bdist_wheel生成的包是否与python2兼容,反之亦然(假设源代码与两个版本都兼容)。

By default, a wheel built with Python 2 will only be valid for Python 2, and a wheel built with Python 3 will only be valid for Python 3. This can be changed by adding the following to the project's setup.cfg file: 默认情况下,使用Python 2构建的轮子仅对Python 2有效,而使用Python 3构建的轮子仅对Python 3有效。这可以通过在项目的setup.cfg文件中添加以下内容来更改:

[bdist_wheel]
universal = 1

With this option added, generated wheels will be "universal", compatible with both Python 2 and Python 3. 添加此选项后,生成的轮子将是“通用的”,与Python 2和Python 3兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM