[英]Python - Building wheel for lxml (setup.py) ... error
我正在嘗試在我的新服務器上運行一些代碼。 這不是我的代碼,但它 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/
向下看堆棧跟蹤,有:
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
如果有人可以幫助我,我將不勝感激
問題解決了...
我已將 requirements.txt 文件更改為不使用指定版本的 lxml,並且一切都安裝得很好。
我猜這個指定的版本對於 python 3.7 來說太舊了
檢查此自述文件: https://lxml.de/installation.html
我猜 lxml 的編譯失敗,如 lxml 文檔中所述,您可以為您的平台提供二進制分發,例如 python3-lxml。
或設置環境以使其可以使用這些先決條件進行構建: libxml2-dev libxslt-dev python-dev
它可以通過sudo apt-get install libxml2-dev libxslt1-dev python-lxml
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.