Linux中Python3.6.6使用pip3安装第三方库报错pip is configured with locations that require TLS/SSL

您所在的位置:网站首页 pip安装第三方库报错 Linux中Python3.6.6使用pip3安装第三方库报错pip is configured with locations that require TLS/SSL

Linux中Python3.6.6使用pip3安装第三方库报错pip is configured with locations that require TLS/SSL

#Linux中Python3.6.6使用pip3安装第三方库报错pip is configured with locations that require TLS/SSL| 来源: 网络整理| 查看: 265

一、环境

Linux:CentOs7.4

Python:Python3.6.6

二、报错情况

使用pip3安装PyMySql时报错如下:

[root@testpc ~]# pip3 install PyMySql pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting PyMySql   Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pymysql/   Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pymysql/   Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pymysql/   Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pymysql/   Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pymysql/   Could not fetch URL https://pypi.org/simple/pymysql/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pymysql/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping   Could not find a version that satisfies the requirement PyMySql (from versions: ) No matching distribution found for PyMySql pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. 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

三、原因及解决办法

因为pip安装第三方库需要ssl模块,而python默认安装ssl功能是不可用的,解决办法是重新编译python3安装文件,加上--with-ssl参数就可以让pip3使用ssl功能了

#重新编译安装 ./configure --prefix=/usr/local/python3 --enable-optimizations --with-ssl make make install #重新第三方库pymysql pip3 intall pymysql



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3