bdist_wheel创建py37 wheel而不是py36 为什么需要py36兼容二进制文件?

问题描述

为了生成sagemaker-training储存库的[pip wheel] [https://github.com/aws/sagemaker-training-toolkit.git]

我跑了

python setup.py bdist_wheel

这会导致创建与python 37兼容的轮子

ls dist/
sagemaker_training-3.6.3.dev0-cp37-cp37m-linux_x86_64.whl

我检查了setup.py;它没有特别提到py37。

有没有办法创建与python36兼容的二进制[pip wheel]?

为什么需要py36兼容二进制文件?

因为py36无法消耗py37车轮

RUN pip3 install sagemaker_training-3.6.3.dev0-cp37-cp37m-linux_x86_64.whl
 ---> Running in ca56241af5fa
ERROR: sagemaker_training-3.6.3.dev0-cp37-cp37m-linux_x86_64.whl is not a supported wheel on this platform.

解决方法

这是因为方向盘与正在调用的Python解释器兼容,也就是说,您可能已经安装了Python 3.7,可以通过运行which python来快速进行验证。

解决方案

考虑pyenv,例如,我将使用python 3.6.1

pyenv install 3.6.1

您可以通过运行来验证安装

ls ~/.pyenv/versions/

,然后将安装的版本设置为global或本地(出于本示例的目的,我将其设置为全局)。

pyenv global 3.6.1

如果您愿意,可以通过以下方式进行验证

python -V

最后,您可以创建一个与Python3.6兼容的轮子。

python setup.py bdist_wheel

参考文献

  1. Pyenv简介(Real Python)。网址:https://realpython.com/intro-to-pyenv/

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...