【问题标题】:Error in installation pycurl 7.19.0安装pycurl 7.19.0时出错
【发布时间】:2016-10-06 18:28:11
【问题描述】:

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

当我尝试使用此命令进行安装时:

pip install 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。

谢谢!

【问题讨论】:

  • 你可以试试sudo apt-get install python-dev然后重试pip install吗?

标签: python ubuntu installation pip pycurl


【解决方案1】:

我遇到了同样的错误,无法找到在 Ubuntu 16.04 上安装 pycurl==7.19.0 的方法。我改为切换到 pycurl==7.43.0 并 pip 安装它就好了。

【讨论】:

    【解决方案2】:

    在环境中运行:

    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
    

    现在检查是否可以在 env 中安装 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

    【讨论】:

    • sudo apt-get install libgnutls-dev 为我解决了问题(Ubuntu 16.04)
    • 如果您收到错误 Package libgnutls-dev is not available 对于最后一个命令,则使用 sudo apt-get install libgnutls-dev 而不是 sudo apt-get install libgnutls28-dev
    • THx @Sherlock。我在 Ubuntu 18.04 上,您的建议有效(与答案中发布的原始建议相反)。
    【解决方案3】:

    apt-get install libpython3.x-dev libnss3 libnss3-dev

    解决了这个问题。 将 x 替换为您的 python 版本

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-26
      • 1970-01-01
      • 2014-02-24
      • 2020-04-01
      • 1970-01-01
      • 2011-02-09
      • 2021-03-09
      相关资源
      最近更新 更多