简体   繁体   English

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

[英]Python pip install failing with error code 1

I am working on CentOS6 and have been able to install python2.7. 我正在使用CentOS6,并且已经能够安装python2.7。 After creating a virtualenv I have started installing various packages of python. 创建virtualenv之后,我已经开始安装各种python软件包。 I can install some packages easily like requests,etc. 我可以轻松地安装一些软件包,例如请求等。 but installing packages like Numpy, scipy, gensim, pycurl are a huge pain. 但是安装Numpy,scipy,gensim,pycurl之类的软件包非常麻烦。 It keeps on giving me this error: 它不断给我这个错误:

By running pip install pycurl from within the virtualenv with python2.7 installed I am running into the problem. 通过在pip install pycurl了python2.7的virtualenv内部运行pip install pycurl ,我pip install pycurl了问题。

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

I am not abel to fix this setup.py egg_info problem. 我不愿意解决这个setup.py egg_info问题。

After running yum install libcurl and then running pip install pycurl i got this: 运行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

You need a libcurl development library . 您需要一个libcurl开发库 Get it with yum: 用yum来获得它:

yum install libcurl-devel

EDIT: After you installed it, you appear to have some missing dependencies, still. 编辑:安装后,您似乎仍然缺少一些依赖项。 You need Python development library , get it with yum as follows: 您需要Python开发库 ,并通过yum获得它,如下所示:

yum install python-devel

If the installation above doesn't work, try rpm instead by download this Python-devel RPM for CentOS . 如果以上安装不起作用,请尝试rpm,方法是下载适用于CentOS的Python-devel RPM Then install it via rpm: 然后通过rpm安装它:

rpm -ivh python-devel-2.7.5-18.el7_1.1.x86_64.rpm

Debian or Ubuntu derived distributions: Debian或Ubuntu衍生的发行版:

apt-get install build-essential libssl-dev libffi-dev python-dev 

Followed by: 其次是:

pip install cryptography

Red Hat derived distributions: 红帽派生的发行版:

yum install gcc openssl-devel libffi-devel python-devel 

Followed by: 其次是:

pip install cryptograph

You need install libcurl development package of your Linux distribution which provides curl libraries and header files. 您需要安装Linux发行版的libcurl开发包,其中提供curl库和头文件。

Go through all "curl" packages for CentOS and you should find the right one. 遍历CentOS的所有“ curl”软件包,您应该找到合适的软件包。

The problem can be with missing dependencies for pycurl. 问题可能出在pycurl缺少依赖项上。 Here is my answer to similar question which worked for me. 这是我对对我有用的类似问题的答案。 Check it here 在这里检查

For me , I installed all the dependencies 对我来说,我安装了所有依赖项

  1. pip install --upgrade setuptools pip install --upgrade setuptools
  2. sudo yum install gcc 须藤yum安装gcc
  3. yum install python-devel 百胜安装python-devel
  4. yum install libcurl-devel 百胜安装libcurl-devel

After installing above , I was getting the same error , then i upgraded pip previously i was using 7.0.1 then i upgraded to 9.0.1 and it worked for me. 在上面安装之后,我遇到了同样的错误,然后我以前升级了pip,我正在使用7.0.1,然后又升级到9.0.1 ,它对我有用

pip install --upgrade pip 点安装-升级点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM