简体   繁体   中英

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. 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.

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

It seems that Apple stopped including OpenSSL headers since OS X 10.11 El Capitan.

To fix this, lets install OpenSSL via Homebrew:
If openssl is not installed install as below. Else if openssl is already installed on your mac, you can skip this.

brew install openssl

You are getting ssl backend errors. 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

Note: check for openssl-dir location on your mac and change as needed.

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

Use sudo if needed.
Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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