我使用的是 Debian 9,并且安装了 Python 3.6.2 和 pip 9.0.1。不过,当我想安装 numpy、scipy 或 matplotlib 等模块时,还是有问题。我在使用pip install命令的时候总是报如下错误:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting numpy Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping Could not find a version that satisfies the requirement numpy (from versions: ) No matching distribution found for numpy
我尝试了这个主题的最佳答案 ( pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)" ) 但它没有用。事实上,我收到了相同的错误消息。
不幸的是,这个命令也失败了。
pip install --index-url=http://pypi.python.org/simple/numpy --trusted-host pypi.python.org numpy
希望有人能解决我的问题。在此先感谢您的帮助。 :D
最佳答案
取消注释 Python-3.6.2/Modules/Setup 中的第 209-212 行
SSL=/usr/local/ssl _ssl _ssl.c\ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl\ -L$(SSL)/lib -lssl -lcrypto
确保安装了 libssl-dev
转到您的 Python 目录并执行 ./configure、make 和 make install
使用以下命令安装包:
pip install --trusted-host pypi.python.org packageName
希望对某人有所帮助。 :D
关于python - pip 安装 : issue with the ssl certificate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46283099/