共计 3144 个字符,预计需要花费 8 分钟才能阅读完成。
行业资讯
服务器
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 错误怎么解决问题上存在疑惑,丸趣 TV 小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”ubuntu pip is configured with locations that require TLS/SSL 错误怎么解决”的疑惑有所帮助!接下来,请跟着丸趣 TV 小编一起来学习吧!
背景:
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 错误怎么解决”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注丸趣 TV 网站,丸趣 TV 小编会继续努力为大家带来更多实用的文章!