2016-06-07 157 views
4

我需要安装这个特定的版本(7.19.0)pycurl。安装pycurl时出错7.19.0

当我尝试用这个命令来安装:

PIP安装pycurl == 7.19.0

我收到此错误。

Failed building wheel for pycurl Running setup.py clean for pycurl Failed to build pycurl Installing collected packages: pycurl 

..... // MULTIPLE LINES 

build/temp.linux-x86_64-2.7/src/pycurl.o: na função `initpycurl': 
    /tmp/pip-build-4Q4V7Q/pycurl/src/pycurl.c:3904: referência indefinida para `PyEval_InitThreads' 
    collect2: error: ld returned 1 exit status 
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

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

如何安装此特定版本?

我使用的是Ubuntu 16.

谢谢!

+0

你可以试试'sudo apt-get install python-dev'并重试'pip install'? – edwinksl

回答

7

运行:

apt-cache depends python-pycurl 

它将输出一些类似:

Depends: python 
    Depends: python 
    Depends: <python:any> 
    python 
    Depends: libc6 
    Depends: libcurl3-gnutls 
    Suggests: libcurl4-gnutls-dev 
    Suggests: python-pycurl-dbg 
    Suggests: python-pycurl-doc 

安装libcurl4-GNUTLS-dev的:

sudo apt-get install libcurl4-gnutls-dev 

检查,如果现在你可以安装pycurl内环境:

pip install pycurl 

如果它不能正常工作,并抛出错误“无法创建轮”或类似的与走得更远:

apt-cache search gnutl | grep dev 

输出是:

libcurl4-gnutls-dev - development files and documentation for libcurl (GnuTLS flavour) 
libgnutls-dev - GNU TLS library - development files 
libgnutls28-dev - dummy transitional package for GNU TLS library - development files 
libneon27-gnutls-dev - Header and static library files for libneon27 (GnuTLS enabled) 
libsoup-gnome2.4-dev - HTTP library implementation in C -- GNOME support development files 

在我的情况下,安装后:

sudo apt-get install libgnutls-dev 

我能够在virtualenv中安装PyCurl

+0

sudo apt-get install libgnutls-dev为我做了诀窍(Ubuntu 16.04) –

0

我有同样的错误,无法找到在Ubuntu 16.04上安装pycurl==7.19.0的方法。我反而切换到pycurl==7.43.0和pip安装它就好了。环境中的