简体   繁体   English

pip install:ssl证书问题

[英]pip install : issue with the ssl certificate

I'm using Debian 9 and I have installed Python 3.6.2 and pip 9.0.1. 我正在使用Debian 9,我已经安装了Python 3.6.2和pip 9.0.1。 Still, there is a problem when I want to install modules like numpy, scipy or matplotlib. 当我想安装像numpy,scipy或matplotlib这样的模块时,仍然存在问题。 I always get the following error when I use the pip install command: 使用pip install命令时,我总是遇到以下错误:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. pip配置了需要TLS / SSL的位置,但Python中的ssl模块不可用。 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. 收集numpy无法获取URL https://pypi.python.org/simple/numpy/ :确认ssl证书时出现问题:无法连接到HTTPS URL,因为SSL模块不可用。 - skipping Could not find a version that satisfies the requirement numpy (from versions: ) No matching distribution found for numpy - 跳过无法找到满足要求numpy的版本(从版本:)没有找到numpy的匹配分发

I tried the top answer of this subject ( pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)" ) but it didn't work. 我尝试了这个主题的最佳答案( pip安装失败,出现“连接错误:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:598)” )但它没有用。 In fact, I get the same error message. 实际上,我得到了相同的错误消息。

Unfortunately, this command was a fail as well. 不幸的是,这个命令也是失败的。

pip install --index-url= http://pypi.python.org/simple/numpy --trusted-host pypi.python.org numpy pip install --index-url = http://pypi.python.org/simple/numpy --trusted-host pypi.python.org numpy

I hope someone will be able to solve my problem. 我希望有人能够解决我的问题。 Thanks in advance for your help. 在此先感谢您的帮助。 :D :d

  1. Uncomment lines 209-212 in Python-3.6.2/Modules/Setup 在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

  2. Make sure libssl-dev is installed 确保已安装libssl-dev

  3. Go to your Python directory and do ./configure, make, and make install 转到Python目录并执行./configure,make和make install

  4. Install packages with the following command: pip install --trusted-host pypi.python.org packageName 使用以下命令安装软件包: pip install --trusted-host pypi.python.org packageName

Hope that helped someone. 希望有人帮助过。 :D :d

我运行以下命令来解决此问题

$ curl https://bootstrap.pypa.io/get-pip.py >> get-pip.py $ python get-pip.py

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

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