在centos7.9上无法为python 3.9安装lxml包
我想在Centos7.9上为我的Python 3.9安装lxml 5.1.0这个包。
我尝试过从.targz
和.whl
文件安装。
使用.whl
文件时,我遇到了以下错误信息:
ERROR: lxml-5.1.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl is not a supported wheel on this platform.
使用.tar.gz
文件时,我需要先安装Cython,但之后我仍然遇到了以下错误信息:
[centos@centos7 package_python39]$ sudo /usr/local/bin/python3.9 -m pip install lxml-5.1.0.tar.gz
Processing ./lxml-5.1.0.tar.gz
Installing build dependencies ... error
error: subprocess-exited-with-error
[...]
ERROR: Could not find a version that satisfies the requirement Cython>=3.0.7 (from versions: none)
ERROR: No matching distribution found for Cython>=3.0.7
[end of output]
不过Cython 3.0.9已经成功安装了:
[centos@centos7 package_python39]$ sudo /usr/local/bin/pip3.9 list
Package Version
---------- -------
Cython 3.0.9
et-xmlfile 1.1.0
htmldom 2.0
openpyxl 3.1.2
pip 23.0.1
setuptools 58.1.0
xlrd3 1.1.0
为什么安装程序不接受这个依赖呢?我该如何在这个平台上成功安装lxml
?
1 个回答
0
问题是我没有网络,而pip似乎需要联网才能从源代码安装(从.whl包安装就没问题)。
所以我需要在pip安装命令中加上“--no-build-isolation”。这就像是个魔法一样……