这篇文章主要介绍“ubuntu pip is configured with locations that require TLS/SSL错误怎么解决”,在日常操作中,相信很多人在ubuntu pip is configured with locations that require TLS/SSL错误怎么解决问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”ubuntu pip is configured with locations that require TLS/SSL错误怎么解决”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
背景:
ubuntu 14.04
python3.8
使用pip install pymsql 提示错误:
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting django WARNING: 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/django/ WARNING: 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/django/ WARNING: 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/django/ WARNING: 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/django/ WARNING: 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/django/ Could not fetch URL https://pypi.org/simple/django/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/django/ (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 django (from versions: none) ERROR: No matching distribution found for django WARNING: 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 --enable-optimizations --with-ssl
Ubuntu 16.04 安装(install)python3.8
第二种解决方法:更换pip源
永久修改pip源
如果需要永久修改pip的软件镜像源,可以通过修改配置文件实现。
在Linux下,修改~/.pip/pip.conf,如果没有则创建:
mkdir ~/.pip vim ~/.pip/pip.conf
[global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host = mirrors.aliyun.com
或者是:
[global] timeout = 6000 index-url = http://pypi.douban.com/simple/ [install] use-mirrors = true mirrors = http://pypi.douban.com/simple/ trusted-host = pypi.douban.com
到此,关于“ubuntu pip is configured with locations that require TLS/SSL错误怎么解决”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注编程之家网站,小编会继续努力为大家带来更多实用的文章!