在 ubuntu 18.04 上安装 pycurl 时出错

在 ubuntu 18.04 上安装 pycurl 时出错

我在安装 pycurl 时遇到错误,第一次发帖比较混乱,请见谅:

$ pip -v install pycurl


  Downloading from URL https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz#sha256=0f0cdfc7a92d4f2a5c44226162434e34f7d6967d3af416a6f1448649c09a25a4 (from https://pypi.org/simple/pycurl/)
  Running setup.py (path:/tmp/pip-build-ziZ0H2/pycurl/setup.py) egg_info for package pycurl
    Running command python setup.py egg_info
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ziZ0H2/pycurl/setup.py", line 913, in <module>
        ext = get_extension(sys.argv, split_extension_source=split_extension_source)
      File "/tmp/pip-build-ziZ0H2/pycurl/setup.py", line 582, in get_extension
        ext_config = ExtensionConfiguration(argv)
      File "/tmp/pip-build-ziZ0H2/pycurl/setup.py", line 99, in __init__
        self.configure()
      File "/tmp/pip-build-ziZ0H2/pycurl/setup.py", line 227, in configure_unix
        raise ConfigurationError(msg)
    __main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory
Cleaning up...
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ziZ0H2/pycurl/
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python2.7/dist-packages/pip/utils/__init__.py", line 725, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ziZ0H2/pycurl/

这只是错误的一部分,太长了,无法发布

答案1

我建议使用 APT 安装 Python-CURL 绑定:

sudo apt install python-pycurl

如果你确实需要从 安装它pip,那么你应该先安装 curl 开发包(已经curl-config安装):

 sudo apt install libcurl4-gnutls-dev

答案2

sudo apt install libcurl4-openssl-dev libssl-dev 在 Ubuntu 18.04 上工作

相关内容