首页 > 解决方案 > 脱机安装加密包失败

问题描述

我正在尝试离线安装以下依赖项:requests and Office365-REST-Python-Client在我的生产环境中。

我使用以下方式下载了压缩包:

pip download - r requests.txt

我得到了以下 .whl

在此处输入图像描述

当我尝试使用以下命令在生产服务器上运行安装时:

pip3 install -r /dumy_path/wheels/requirements.txt --no-index --find-links file:///dumy_path/wheels

我收到加密包的以下错误:

Collecting Office365-REST-Python-Client==2.3.2 (from -r /dumy_path/wheels/requirements.txt (line 1))

Collecting requests (from -r /dumy_path/wheels/requirements.txt (line 2))

Collecting msal (from Office365-REST-Python-Client==2.3.2->-r /dumy_path/wheels/requirements.txt (line 1))

Collecting idna<3,>=2.5 (from requests->-r /dumy_path/wheels/requirements.txt (line 2))

Collecting urllib3<1.27,>=1.21.1 (from requests->-r /dumy_path/wheels/requirements.txt (line 2))

Collecting certifi>=2017.4.17 (from requests->-r /dumy_path/wheels/requirements.txt (line 2))

Collecting chardet<5,>=3.0.2 (from requests->-r /dumy_path/wheels/requirements.txt (line 2))

Collecting PyJWT[crypto]<3,>=1.0.0 (from msal->Office365-REST-Python-Client==2.3.2->-r /dumy_path/wheels/requirements.txt (line 1))

Collecting cryptography<4,>=0.6 (from msal->Office365-REST-Python-Client==2.3.2->-r /dumy_path/wheels/requirements.txt (line 1))

  Could not find a version that satisfies the requirement cryptography<4,>=0.6 (from msal->Office365-REST-Python-Client==2.3.2->-r /dumy_path/wheels/requirements.txt (line 1)) (from versions: )

No matching distribution found for cryptography<4,>=0.6 (from msal->Office365-REST-Python-Client==2.3.2->-r /dumy_path/wheels/requirements.txt (line 1))

生产环境是 Redhat 7.9,开发环境是 Fedora Workstation 33 我该如何解决这个问题?谢谢

标签: python-3.xpippython-wheel

解决方案


所以这可能是一两件事或两者的结合。

如果您注意到 Cryptography 是依赖于体系结构的,那么它会被标记manylinux2014_x86_64为它是为 CPython 3.6 和 ABI3 构建的。这意味着它是一个 C/C++ 模块,专为使用 x86_64 架构的较新 Linux 平台构建。

所以首先要检查的是,两台机器是同一个拱门吗?uname -m 其次,两台机器都使用相同的 Python 版本吗?python3 --version

第一个赠品是您的开发机器是 Fedora 33,但服务器是 RHEL 7,而 RHEL 7 基于 Fedora 19。

因此,您的 Dev 和 Prod 服务器远非相同,因此不太可能是相同的 Python3 版本。

如果你想确保更好的兼容性,你应该使用 CentOS 7 作为你的开发,你可能会有零差异,从而解决你的问题。


推荐阅读