温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
  • 首页 > 
  • 教程 > 
  • 服务器 > 
  • ubuntu pip is configured with locations that require TLS/SSL错误怎么解决

ubuntu pip is configured with locations that require TLS/SSL错误怎么解决

发布时间:2022-11-17 10:00:20 来源:亿速云 阅读:371 作者:iii 栏目:服务器

这篇文章主要介绍“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错误怎么解决”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI