使用pip在macos上安装pycurl失败



我希望有人能帮忙。我目前正在Sierra 10.12.6上运行的2015 MacBook Pro上构建我的python环境。我在下载模块以运行自动化工作任务所需的脚本(如自动化电子邮件等(时遇到了许多问题,但我已经设法克服了这些问题,然而,PyCurl不允许我克服这些问题。

我使用的命令以及各种变体本质上是-

sudo pip install pycurl

返回以下内容-

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/

最后的错误真的困扰着我和团队中的开发人员,我真的希望有人能帮助我,因为我已经耗尽了办公室的资源!

编辑:我认为SSL后端问题是的首要问题

苹果似乎从OS X 10.11 El Capitan开始停止包含OpenSSL头文件。

要解决此问题,请通过Homebrew安装OpenSSL:
如果未安装openssl,请按以下方式安装。否则,如果你的mac上已经安装了openssl,你可以跳过这个。

brew install openssl

您收到ssl后端错误。为了帮助pycurl找到OpenSSL头,我们需要告诉setup.py要使用哪个SSL后端以及在哪里可以找到OpenSSL

注意:检查mac上的openssl目录位置,并根据需要进行更改。

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

如果需要的话,可以使用sudo
希望这能有所帮助。

最新更新