简体   繁体   English

使用pip在MacOS上安装pycurl失败

[英]Failed pycurl install on macos using pip

I hope someone can help. 我希望有人能帮帮忙。 I am currently building my python environment on my 2015 MacBook Pro which is running on Sierra 10.12.6. 我目前正在2015年的MacBook Pro上构建python环境,该环境在Sierra 10.12.6上运行。 I have stumbled accrossed many issues downloading modules in order to run my scripts needed to automate tasks for my job (such as automated emails etc) but I have managed to overcome such things, however, PyCurl will not allow me to overcome. 我偶然遇到了许多问题,例如下载模块以运行我的脚本来执行工作任务所需的脚本(例如自动电子邮件等),但是我设法克服了这些问题,但是PyCurl不允许我克服这些问题。

the command, along with various variants, i am using is essentially - 我正在使用的命令以及各种变体基本上是-

sudo pip install pycurl

which returns the following - 返回以下内容-

Collecting pycurl
Downloading https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz (214kB)
100% |████████████████████████████████| 215kB 5.7MB/s
Complete output from command python setup.py egg_info:
Using curl-config (libcurl 7.54.0)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/tmp/pip-install-rSkgA_/pycurl/setup.py", line 913, in <module>
    ext = get_extension(sys.argv, split_extension_source=split_extension_source)
  File "/private/tmp/pip-install-rSkgA_/pycurl/setup.py", line 582, in get_extension
    ext_config = ExtensionConfiguration(argv)
  File "/private/tmp/pip-install-rSkgA_/pycurl/setup.py", line 99, in __init__
    self.configure()
  File "/private/tmp/pip-install-rSkgA_/pycurl/setup.py", line 316, in configure_unix
    specify the SSL backend manually.''')
__main__.ConfigurationError: Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-rSkgA_/pycurl/

the error at the end is really stumping me and the devs that work in my team, I really hope someone can helps as I have exhausted the resources in my office! 最后的错误确实让我和团队中的开发人员感到沮丧,我真的希望有人能在我用尽办公室资源的同时为您提供帮助!

EDIT: the SSL backend issue is what i believe to be the overarching issue 编辑:SSL后端问题是我认为是首要问题

It seems that Apple stopped including OpenSSL headers since OS X 10.11 El Capitan. 自OS X 10.11 El Capitan以来, Apple似乎不再包括OpenSSL标头

To fix this, lets install OpenSSL via Homebrew: 要解决此问题,请通过Homebrew安装OpenSSL:
If openssl is not installed install as below. 如果未安装openssl请按照以下说明进行安装。 Else if openssl is already installed on your mac, you can skip this. 否则,如果您的Mac上已经安装了openssl则可以跳过此步骤。

brew install openssl

You are getting ssl backend errors. 您收到ssl后端错误。 In order to help pycurl find the OpenSSL headers, we need to tell setup.py which SSL backend to use and where OpenSSL can be found 为了帮助pycurl找到OpenSSL标头,我们需要告诉setup.py使用哪个SSL后端以及在哪里可以找到OpenSSL

Note: check for openssl-dir location on your mac and change as needed. 注意:检查Mac上的openssl-dir位置,然后根据需要进行更改。

pip uninstall pycurl
pip install --install-option="--with-openssl" --install-option="--openssl-dir=/usr/local/opt/openssl" pycurl

Use sudo if needed. 如果需要,请使用sudo。
Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM