python - 安装pycurl 7.19.0报错

标签 python ubuntu installation pip pycurl

我需要安装这个特定版本 (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。

谢谢!

最佳答案

在环境中运行:

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

关于python - 安装pycurl 7.19.0报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37669428/

相关文章:

mysql - 如何添加mysql skip name resolve

email - 查找 ubuntu postfix 邮件服务器的 smtp 用户名和密码?

installation - 无法在新的 debian 8 jessie 上安装 docker

macos - 如何安装旧版本的 MonoTouch?

python - 属性错误 : 'NoneType' object has no attribute 'time' paramiko

java - 是否鼓励在 Java 中使用多处理池?我有正在转换为 Java 的 Python 代码

python - 使用 Python 和 Beautiful Soup 解析 HTML

apache - LAMPP 启动失败并出现错误 2

ruby - 如何使用 Chocolatey 覆盖 Ruby 和 Ruby DevKit 安装目录?

python - 如何使用 python 脚本安装 msi?