美文网首页
如何解决pip安装时出现的ssl certificate报错

如何解决pip安装时出现的ssl certificate报错

作者: xuzhougeng | 来源:发表于2020-04-29 16:39 被阅读0次

机械性的安装Python3之后,随后用python3 get-pip.py开始安装pip,出现了如下的报错

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
ERROR: Could not find a version that satisfies the requirement pip (from versions: none)
ERROR: No matching distribution found for pip

通过检索,发现是编译过程中漏掉了SSL的支持,于是,我检查了下我的编译日志信息

running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_sqlite3              _ssl                  _tkinter           
readline                                                       
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
atexit                pwd                   time 

果不其然,从日志中发现了问题所在,发现_ssl库没有安装,解决方法就是安装openssl-devel

# 顺手解决 Can't locate Tcl/Tk libs and/or headers
sudo yum install tcl-devel tk-devel
# 解决_ssl问题
sudo yum install openssl-devel

重新编译之后,就没有对应的问题了。

相关文章

网友评论

      本文标题:如何解决pip安装时出现的ssl certificate报错

      本文链接:https://www.haomeiwen.com/subject/dzhnwhtx.html