我正试着在我的新服务器上运行一些代码。这不是我的代码,但它是100%工作的,因为它在其他机器上运行得很流畅。当我试图从需求文件中安装所需的模块时,我得到了以下错误
ERROR: Command errored out with exit status 1:
command: /srv/usosapi-env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1g1om26q/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1g1om26q/lxml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-drhhibz7
cwd: /tmp/pip-install-1g1om26q/lxml/向下查看stacktrace,可以看到:
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/include/python3.7m -I/srv/usosapi-env/include/python3.7m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.7/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c: In function ‘__Pyx_ExceptionSave’:
src/lxml/lxml.etree.c:221049:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?以及其他函数的一些相同的错误。
以下是我的需求文件:
Django >=1.11, < 2.0
mysqlclient == 1.3.13
cx_Oracle == 5.2.1
lxml == 3.6.2
beautifulsoup4
pylibmc == 1.5.1
django-statsd-mozilla == 0.3.16
statsd == 2.1.2
pillow == 3.2.0
wand >= 0.4.4, <0.5
pycurl >= 7.19.5.1, <7.19.6
PyYAML==5.1.2
tornado == 3.2.2
icalendar == 3.6.2
python-dateutil == 2.5.3
contexttimer == 0.3.1
signxml == 2.5.2
sqlparse == 0.2.1
python-magic == 0.4.12
simplejson==3.10.0
firebase-admin>=2.13
oauth2client==4.1.3
SQLAlchemy==1.2.11
Arpeggio==1.9.0
django-oauth-toolkit==1.1.0
typing
zeep==3.4.0
pyOpenSSL==17.5.0和通过pip安装在virtualenv中的模块:
Package Version
------------- -------
cx-Oracle 5.2.1
Django 1.11.29
mysqlclient 1.3.13
pip 20.1.1
pkg-resources 0.0.0
pytz 2020.1
setuptools 46.4.0
wheel 0.34.2我还尝试安装最新的cython (如下所示),但没有结果
Collecting Cython
Using cached Cython-0.29.19-cp37-cp37m-manylinux1_x86_64.whl (2.0 MB)
Installing collected packages: Cython
Successfully installed Cython-0.29.19如果有人能帮我,我将不胜感激
发布于 2020-05-27 15:11:45
问题已解决...
我已经将requirements.txt文件更改为不使用指定版本的lxml,并且一切安装正常。
我猜指定的版本对于python3.7来说太旧了
发布于 2020-05-26 14:48:03
查看此自述文件:https://lxml.de/installation.html
我猜lxml的编译失败了,正如lxml文档中所描述的,您可以为您的平台提供二进制发行版,例如python3-lxml。
或设置环境,以使用以下先决条件进行构建: libxml2-dev libxslt-dev python-dev
https://stackoverflow.com/questions/62015991
复制相似问题