gpt4 book ai didi

Python pip 安装失败,错误代码为 1

转载 作者:行者123 更新时间:2023-12-04 19:33:05 26 4
gpt4 key购买 nike

我正在使用 CentOS6 并且已经能够安装 python2.7。创建 virtualenv 后,我开始安装各种 python 包。我可以很容易地安装一些包,比如请求等。但是安装 Numpy、scipy、gensim、pycurl 等软件包是一件非常痛苦的事情。它不断给我这个错误:

通过运行 pip install pycurl在安装了 python2.7 的 virtualenv 中,我遇到了问题。

Collecting pycurl
Downloading pycurl-7.19.5.1.tar.gz (142kB)
100% |████████████████████████████████| 143kB 2.8MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-ClD2EM/pycurl/setup.py", line 634, in <module>
ext = get_extension(split_extension_source=split_extension_source)
File "/tmp/pip-build-ClD2EM/pycurl/setup.py", line 392, in get_extension
ext_config = ExtensionConfiguration()
File "/tmp/pip-build-ClD2EM/pycurl/setup.py", line 65, in __init__
self.configure()
File "/tmp/pip-build-ClD2EM/pycurl/setup.py", line 100, in configure_unix
raise ConfigurationError(msg)
__main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ClD2EM/pycurl

我不能解决这个 setup.py egg_info 问题。

运行后 yum install libcurl然后运行 ​​ pip install pycurl我懂了:
Collecting pycurl
Using cached pycurl-7.19.5.1.tar.gz
Building wheels for collected packages: pycurl
Running setup.py bdist_wheel for pycurl
Complete output from command /home/pgupta/python27_project/bin/python2.7 -c "import setuptools;__file__='/tmp/pip-build-bH6H_j/pycurl/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpG3CwZBpip-wheel-:
Using curl-config (libcurl 7.19.7)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/curl
copying python/curl/__init__.py -> build/lib.linux-x86_64-2.7/curl
running build_ext
building 'pycurl' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYCURL_VERSION="7.19.5.1" -DHAVE_CURL_SSL=1 -I/usr/include/python2.7 -c src/docstrings.c -o build/temp.linux-x86_64-2.7/src/docstrings.o
In file included from src/docstrings.c:4:
src/pycurl.h:4:20: error: Python.h: No such file or directory
src/pycurl.h:5:22: error: pythread.h: No such file or directory
src/pycurl.h:56:4: error: #error "Need Python version 2.4 or greater to compile pycurl."
src/pycurl.h:165:5: warning: #warning "libcurl was compiled with SSL support, but configure could not determine which " "library was used; thus no SSL crypto locking callbacks will be set, which may " "cause random crashes on SSL requests"
In file included from src/docstrings.c:4:
src/pycurl.h:232: error: expected ‘)’ before ‘*’ token
src/pycurl.h:234: error: expected ‘)’ before ‘*’ token
src/pycurl.h:236: error: expected ‘)’ before ‘*’ token
src/pycurl.h:286: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
src/pycurl.h:328: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
src/pycurl.h:343: error: expected specifier-qualifier-list before ‘PyThread_type_lock’
src/pycurl.h:347: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
src/pycurl.h:397: error: expected ‘)’ before ‘*’ token
src/pycurl.h:398: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:406: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:408: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:410: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:415: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Curl_Type’
src/pycurl.h:416: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CurlMulti_Type’
src/pycurl.h:417: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CurlShare_Type’
src/pycurl.h:419: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:420: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:421: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:422: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:424: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:425: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:426: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
error: command 'gcc' failed with exit status 1

----------------------------------------
Failed building wheel for pycurl
Failed to build pycurl
Installing collected packages: pycurl
Running setup.py install for pycurl
Complete output from command /home/pgupta/python27_project/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-bH6H_j/pycurl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Iit36I-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pgupta/python27_project/include/site/python2.7/pycurl:
Using curl-config (libcurl 7.19.7)
running install
running build
running build_py
running build_ext
building 'pycurl' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYCURL_VERSION="7.19.5.1" -DHAVE_CURL_SSL=1 -I/usr/include/python2.7 -c src/docstrings.c -o build/temp.linux-x86_64-2.7/src/docstrings.o
In file included from src/docstrings.c:4:
src/pycurl.h:4:20: error: Python.h: No such file or directory
src/pycurl.h:5:22: error: pythread.h: No such file or directory
src/pycurl.h:56:4: error: #error "Need Python version 2.4 or greater to compile pycurl."
src/pycurl.h:165:5: warning: #warning "libcurl was compiled with SSL support, but configure could not determine which " "library was used; thus no SSL crypto locking callbacks will be set, which may " "cause random crashes on SSL requests"
In file included from src/docstrings.c:4:
src/pycurl.h:232: error: expected ‘)’ before ‘*’ token
src/pycurl.h:234: error: expected ‘)’ before ‘*’ token
src/pycurl.h:236: error: expected ‘)’ before ‘*’ token
src/pycurl.h:286: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
src/pycurl.h:328: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
src/pycurl.h:343: error: expected specifier-qualifier-list before ‘PyThread_type_lock’
src/pycurl.h:347: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
src/pycurl.h:397: error: expected ‘)’ before ‘*’ token
src/pycurl.h:398: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:406: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:408: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:410: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:415: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Curl_Type’
src/pycurl.h:416: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CurlMulti_Type’
src/pycurl.h:417: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CurlShare_Type’
src/pycurl.h:419: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:420: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:421: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:422: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:424: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:425: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/pycurl.h:426: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/home/pgupta/python27_project/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-bH6H_j/pycurl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Iit36I-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pgupta/python27_project/include/site/python2.7/pycurl" failed with error code 1 in /tmp/pip-build-bH6H_j/pycurl

最佳答案

您需要一个 libcurl 开发库 .用 yum 获取它:

yum install libcurl-devel

编辑:安装后,您似乎仍然缺少一些依赖项。您需要 Python开发库 ,用yum获取如下:
yum install python-devel

如果上述安装不起作用,请尝试 转数 而是通过下载 Python-devel RPM for CentOS .然后通过 rpm 安装它:
rpm -ivh python-devel-2.7.5-18.el7_1.1.x86_64.rpm

关于Python pip 安装失败,错误代码为 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31481849/

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