【问题标题】:Python - Building wheel for lxml (setup.py) ... errorPython - lxml(setup.py)的构建轮......错误
【发布时间】:2020-05-26 06:32:40
【问题描述】:

我正在尝试在我的新服务器上运行一些代码。这不是我的代码,但它是 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 在 vi​​rtualenv 中安装的模块:

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

如果有人可以帮助我,我将非常感激

【问题讨论】:

    标签: python django linux python-3.7


    【解决方案1】:

    问题已解决...

    我已将 requirements.txt 文件更改为不使用指定版本的 lxml,并且一切安装正常。

    我猜指定的版本对于 python 3.7 来说太旧了

    【讨论】:

      【解决方案2】:

      查看此自述文件:https://lxml.de/installation.html

      我猜 lxml 的编译会失败,如 lxml 文档中所述,您可以为您的平台提供二进制分发,例如 python3-lxml。

      或设置环境以使其可以使用以下先决条件进行构建: libxml2-dev libxslt-dev python-dev

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-12-27
        • 1970-01-01
        • 2023-03-26
        • 1970-01-01
        • 2019-09-26
        • 1970-01-01
        • 2019-07-01
        • 2020-10-02
        相关资源
        最近更新 更多