我试图安装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

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


当前回答

与yum package manager类似

yum install libcurl-devel

如果你使用dnf,使用

dnf install libcurl-devel

其他回答

如果以下解决方案在安装时出错,

sudo apt install libcurl4-openssl-dev libssl-dev

然后尝试先更新你的Linux操作系统:

sudo apt update

在我的案例中,这解决了问题:

sudo apt-get install libssl-dev libcurl4-openssl-dev python-dev

正如这里所解释的

OpenSUSE:

zypper in libcurl-devel 

在Alpine linux中,你应该做:

apk add curl-dev python3-dev libressl-dev

我在Mac上有这个问题,这与openssl包是pycurl所要求的旧版本有关。根据我的理解,Pycurl可以使用其他SSL库,而不是openssl。验证您正在使用的ssl库并进行更新,因为它很可能解决问题。

我通过:

运行brew升级 下载了最新的pycurl-x.y.z.tar.gz http://pycurl.io/ 提取上面的包,并将目录更改到其中 运行python setup.py——with-openssl install,因为openssl是我已经安装的库。如果你的ssl库是gnutls或nss,那么必须相应地使用——with-gnutls或——with-nss。你可以在他们的github存储库中找到更多的安装信息。