gpt4 book ai didi

python - 为 cffi (setup.py) 构建轮子……从 django 中的 requirements.txt 安装包时出错

转载 作者:行者123 更新时间:2023-12-04 14:06:37 25 4
gpt4 key购买 nike

我正在尝试从 git 安装一个新的 Django 项目,我使用创建了一个新的虚拟环境
python3(版本:3.8.5)。当我尝试在 requirements.txt 中安装所需的库时,我收到 cffi==1.11.5 包的以下错误。

Building wheels for collected packages: cffi
Building wheel for cffi (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/jessica/Documents/FreelanceProjects/crowdbuy/env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-71z3f0vy/cffi_136411f3ae2d49e4b889de52edc8d550/setup.py'"'"'; __file__='"'"'/tmp/pip-install-71z3f0vy/cffi_136411f3ae2d49e4b889de52edc8d550/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-1y2in5qm
cwd: /tmp/pip-install-71z3f0vy/cffi_136411f3ae2d49e4b889de52edc8d550/
Complete output (49 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/home/jessica/Documents/FreelanceProjects/crowdbuy/env/include -I/usr/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
c/_cffi_backend.c: In function ‘b_do_dlopen’:
c/_cffi_backend.c:4197:31: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
4197 | *p_printable_filename = PyText_AsUTF8(s);
| ^
c/_cffi_backend.c: In function ‘b_callback’:
c/_cffi_backend.c:5911:5: warning: ‘ffi_prep_closure’ is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
5911 | if (ffi_prep_closure(closure, &cif_descr->cif,
| ^~
In file included from c/_cffi_backend.c:15:
/usr/include/x86_64-linux-gnu/ffi.h:334:1: note: declared here
334 | ffi_prep_closure (ffi_closure*,
| ^~~~~~~~~~~~~~~~
In file included from c/cffi1_module.c:20,
from c/_cffi_backend.c:7370:
c/call_python.c: In function ‘_get_interpstate_dict’:
c/call_python.c:20:30: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
20 | builtins = tstate->interp->builtins;
| ^~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cffi
Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: pycparser, urllib3, six, pytz, jdcal, idna, et-xmlfile, chardet, cffi, certifi, asn1crypto, xlwt, xlrd, unicodecsv, text-unidecode, requests, PyYAML, python-dateutil, openpyxl, odfpy, oauthlib, Django, defusedxml, cryptography, tablib, sqlparse, requests-oauthlib, python3-openid, pyOpenSSL, Pillow, phonenumberslite, pbr, Faker, django-ranged-response, django-js-asset, diff-match-patch, Babel, Unidecode, sorl-thumbnail, PyMySQL, purl, paypalrestsdk, mock, future, factory-boy, django-widget-tweaks, django-treebeard, django-tables2, django-simple-captcha, django-phonenumber-field, django-paypal, django-mptt, django-modeltranslation, django-import-export, django-haystack, django-filter, django-extra-views, django-debug-toolbar, django-crontab, django-countries, django-anymail, django-allauth, django-admin-honeypot
Running setup.py install for cffi ... error
ERROR: Command errored out with exit status 1:
command: /home/jessica/Documents/FreelanceProjects/crowdbuy/env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-71z3f0vy/cffi_136411f3ae2d49e4b889de52edc8d550/setup.py'"'"'; __file__='"'"'/tmp/pip-install-71z3f0vy/cffi_136411f3ae2d49e4b889de52edc8d550/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-yjyoqxw6/install-record.txt --single-version-externally-managed --compile --install-headers /home/jessica/Documents/FreelanceProjects/crowdbuy/env/include/site/python3.8/cffi
cwd: /tmp/pip-install-71z3f0vy/cffi_136411f3ae2d49e4b889de52edc8d550/
Complete output (49 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/home/jessica/Documents/FreelanceProjects/crowdbuy/env/include -I/usr/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
c/_cffi_backend.c: In function ‘b_do_dlopen’:
c/_cffi_backend.c:4197:31: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
4197 | *p_printable_filename = PyText_AsUTF8(s);
| ^
c/_cffi_backend.c: In function ‘b_callback’:
c/_cffi_backend.c:5911:5: warning: ‘ffi_prep_closure’ is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
5911 | if (ffi_prep_closure(closure, &cif_descr->cif,
| ^~
In file included from c/_cffi_backend.c:15:
/usr/include/x86_64-linux-gnu/ffi.h:334:1: note: declared here
334 | ffi_prep_closure (ffi_closure*,
| ^~~~~~~~~~~~~~~~
In file included from c/cffi1_module.c:20,
from c/_cffi_backend.c:7370:
c/call_python.c: In function ‘_get_interpstate_dict’:
c/call_python.c:20:30: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
20 | builtins = tstate->interp->builtins;
| ^~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/jessica/Documents/FreelanceProjects/crowdbuy/env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-71z3f0vy/cffi_136411f3ae2d49e4b889de52edc8d550/setup.py'"'"'; __file__='"'"'/tmp/pip-install-71z3f0vy/cffi_136411f3ae2d49e4b889de52edc8d550/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-yjyoqxw6/install-record.txt --single-version-externally-managed --compile --install-headers /home/jessica/Documents/FreelanceProjects/crowdbuy/env/include/site/python3.8/cffi Check the logs for full command output.

我还将添加我的 requirements.txt 文件。
asn1crypto==0.24.0
Babel==2.5.3
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
cryptography==2.2.2
defusedxml==0.5.0
diff-match-patch==20121119
Django==2.0.4
django-admin-honeypot==1.1.0
django-allauth==0.35.0
django-anymail==2.0
django-countries==5.3
django-debug-toolbar==1.9.1
django-extra-views==0.6.4
django-filter==1.1.0
django-haystack==2.8.1
django-import-export==1.0.1
django-js-asset==1.0.0
django-modeltranslation==0.12.2
django-mptt==0.9.0
django-paypal==0.5.0
django-phonenumber-field==1.3.0
django-ranged-response==0.2.0
django-simple-captcha==0.5.6
django-tables2==1.16.0
django-treebeard==4.3
django-widget-tweaks==1.4.2
et-xmlfile==1.0.1
factory-boy==2.10.0
Faker==0.8.13
future==0.16.0
idna==2.6
jdcal==1.4
mock==2.0.0
oauthlib==2.0.7
odfpy==1.3.6
openpyxl==2.5.4
paypalrestsdk==1.13.1
pbr==4.0.2
phonenumberslite==8.9.3
Pillow==5.1.0
purl==1.4
pycparser==2.18
PyMySQL==0.8.0
pyOpenSSL==17.5.0
python-dateutil==2.7.2
python3-openid==3.1.0
pytz==2018.4
PyYAML==3.12
requests==2.18.4
requests-oauthlib==0.8.0
six==1.11.0
sorl-thumbnail==12.4.1
sqlparse==0.2.4
tablib==0.12.1
text-unidecode==1.2
unicodecsv==0.14.1
Unidecode==0.4.21
urllib3==1.22
xlrd==1.1.0
xlwt==1.3.0
django-crontab

我已经遵循了有关 stackoverflow 的一些建议,但这似乎不起作用。
我已经尝试过的事情。
Failed to install Python Cryptography package with PIP and setup.py
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
我正在使用 Ubuntu。请让我知道我做错了什么。

最佳答案

我遇到了这个问题,我通过以下方式解决了:
我用过 sudo apt install --fix-broken为了在我的 debian 机器上安装损坏的软件包,我使用这个命令来安装必要的软件包
:sudo apt-get install build-essential libssl-dev libffi-dev python-dev之后问题就解决了。

关于python - 为 cffi (setup.py) 构建轮子……从 django 中的 requirements.txt 安装包时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68094955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com