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

机械性的安装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

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容