问题
Every time I try to pip install something, this happens:
Lucianos-Mac:test luciano$ pip install torch
Collecting torch
Could not install packages due to an EnvironmentError: Could not find a suitable TLS CA certificate bundle, invalid path: /Users/luciano/Applications/NextGIS/Library/Frameworks/openssl.framework/Resources/ssl/certs/cert.pem
The path it references was created when I installed the gdal package from nextgis.com, which I later deleted, so the NextGIS directory does not exist. However, pip still looks there for a certificate and I don't know how to change this. I'm using Python 3.6 with Pip 19.0.3 on MacOS 10.14.
EDIT: env | grep cert
outputs
SSL_CERT_FILE=/Users/luciano/Applications/NextGIS/Library/Frameworks/openssl.framework/Resources/ssl/certs/cert.pem
CURL_CA_BUNDLE=/Users/luciano/Applications/NextGIS/Library/Frameworks/openssl.framework/Resources/ssl/certs/cert.pem
unsetting these temporarily solve the problem, but when I restart the terminal, they are set again, and I don't know where.
回答1:
Delete (or edit) these two files:
/Users/<user>/Library/LaunchAgents/setenv.CURL_CA_BUNDLE.plist
/Users/<user>/Library/LaunchAgents/setenv.SSL_CERT_FILE.plist
In the same folder NextGIS puts three other files that are setting ENV variables. I think they also should be taken care of.
回答2:
You can trace the environment variable to wherever it gets set by:
$ PS4='+$BASH_SOURCE> ' BASH_XTRACEFD=7 bash -xl 2> ~/desktop/trace.log ; reset
Followed by Control + C
Then issue the following command:
$ grep REQUESTS_CA_BUNDLE ~/desktop/trace.log
It should return the location of where it's getting set within your environment.
回答3:
I had this problem after a failed attempt to install Docker. The process did have something to do with ca-certificates. So I install the package with
sudo apt install ca-certificates
and voila, things get back to normal again. Hope this help.
来源:https://stackoverflow.com/questions/55106409/pip-install-tls-ca-issue