我试图安装pycurl通过:

sudo pip install pycurl

它下载得很好,但是当它运行setup.py时,我得到了以下回溯:

Downloading/unpacking pycurl
  Running setup.py egg_info for package pycurl
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip-build-root/pycurl/setup.py", line 563, in <module>
        ext = get_extension()
      File "/tmp/pip-build-root/pycurl/setup.py", line 368, in get_extension
        ext_config = ExtensionConfiguration()
      File "/tmp/pip-build-root/pycurl/setup.py", line 65, in __init__
        self.configure()
      File "/tmp/pip-build-root/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
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/tmp/pip-build-root/pycurl/setup.py", line 563, in <module>

    ext = get_extension()

  File "/tmp/pip-build-root/pycurl/setup.py", line 368, in get_extension

    ext_config = ExtensionConfiguration()

  File "/tmp/pip-build-root/pycurl/setup.py", line 65, in __init__

    self.configure()

  File "/tmp/pip-build-root/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

你知道为什么会发生这种事,以及如何解决吗


当前回答

在Debian上,我需要以下包来解决这个问题

sudo apt install libcurl4-openssl-dev libssl-dev

其他回答

与yum package manager类似

yum install libcurl-devel

如果你使用dnf,使用

dnf install libcurl-devel

在Alpine linux中,你应该做:

apk add curl-dev python3-dev libressl-dev

我在Ubuntu上启动Shinken 2.0.3时也遇到了同样的问题。最终,我完全卸载了Shinken,然后用pip -v重新安装了Shinken。在清理过程中,它提到:

警告:缺少python-pycurl lib,您必须在启动shinken守护进程之前安装它

安装了apt-get,所有的经纪人都像预期的那样被激活了:-)

除了eldos的答案,我还需要CentOS 7中的gcc:

yum install libcurl-devel gcc

这解决了我在Ubuntu 14.04上的问题:

安装libcurl4-gnutls-dev