Python 安装pycurl时“无法运行curl-config:[Errno 2]没有这样的文件或目录”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23937933/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 03:43:32  来源:igfitidea点击:

"Could not run curl-config: [Errno 2] No such file or directory" when installing pycurl

pythoninstallpycurl

提问by user3688241

I'm trying to install pycurl via:

我正在尝试通过以下方式安装 pycurl:

sudo pip install pycurl

It downloaded fine, but when when it runs setup.py I get the following traceback:

它下载得很好,但是当它运行 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

Any idea why this is happening and how to get around it

知道为什么会发生这种情况以及如何解决它

采纳答案by Michael Rice

On Debian I needed the following packages to fix this

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

sudo apt install libcurl4-openssl-dev libssl-dev

回答by Chris Woods

I encountered the same problem whilst trying to get Shinken 2.0.3 to fire up on Ubuntu. Eventually I did a full uninstall then reinstalled Shinken with pip -v. As it cleaned up, it mentioned:

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

Warning: missing python-pycurl lib, you MUST install it before launch the shinken daemons

Warning: missing python-pycurl lib, you MUST install it before launch the shinken daemons

Installed that with apt-get, and all the brokers fired up as expected :-)

安装了它apt-get,所有的经纪人都按预期启动了:-)

回答by eldos

Similarly with yumpackage manager

yum包管理器类似

yum install libcurl-devel

If you use dnf, use

如果您使用dnf,请使用

dnf install libcurl-devel

回答by Elliott

On OpenSUSE:

在 OpenSUSE 上:

zypper in libcurl-devel 

回答by dnaranjo

That solved my problem on Ubuntu 14.04:

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

apt-get install libcurl4-gnutls-dev

apt-get install libcurl4-gnutls-dev

回答by muimota

in my case this fixed the problem:

就我而言,这解决了问题:

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

as explained here

为解释在这里

回答by T. Ferriera

In my case i kept getting the same error message. I use fedora. I solved it by doing:

就我而言,我一直收到相同的错误消息。我用软呢帽。我通过执行以下操作解决了它:

sudo dnf install pycurl

This installed eveything that I needed for it to work.

这安装了我运行所需的一切。

回答by Alex

In Alpine linux you should do:

在 Alpine linux 中,您应该执行以下操作:

apk add curl-dev python3-dev libressl-dev

回答by SylvesterAbreuLoreto

I had this issue on Mac and it was related to the opensslpackage being an older version of what it was required by pycurl. pycurlcan use other ssl libraries rather than openssl as per my understanding of it. Verify which ssl library you're using and update as it is very likely to fix the issue.

我在 Mac 上遇到了这个问题,它与openssl软件包是pycurl. pycurl根据我的理解,可以使用其他 ssl 库而不是 openssl。验证您正在使用和更新哪个 ssl 库,因为它很可能解决问题。

I fixed this by:

我通过以下方式解决了这个问题:

  • running brew upgrade
  • downloaded the latest pycurl-x.y.z.tar.gzfrom http://pycurl.io/
  • extracted the package above and change directory into it
  • ran python setup.py --with-openssl installas openssl is the library I have installed. If you're ssl library is either gnutlsor nssthen will have to use --with-gnutlsor --with-nssaccordingly. You'll be able to find more installation info in their github repository.
  • 跑步 brew upgrade
  • pycurl-x.y.z.tar.gzhttp://pycurl.io/下载最新的
  • 提取上面的包并将目录更改为
  • python setup.py --with-openssl install作为 openssl运行的是我安装的库。如果你是SSL库或者是gnutls还是nss那么将不得不使用--with-gnutls--with-nss相应。您将能够在他们的 github 存储库中找到更多安装信息

回答by alelorca

In addition to the answer of eldosI also needed gccin CentOS 7:

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

yum install libcurl-devel gcc