Could not fetch URL https://mirrors.aliyun.com: a problem confirming the ssl certificate

错误发生介绍:
阿里云服务器安装库文件总是提醒无法连接镜像地址:Could not fetch URL https://mirrors.aliyun.com/pypi/simple/lxml/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘mirrors.aliyun.com’, port=443)
以及
Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”

原代码运行情况:

#安装代码
[root@Z /]# sudo pip3 install lxml

#警告;无法连接
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
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.",)': /pypi/simple/lxml/
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.",)': /pypi/simple/lxml/
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.",)': /pypi/simple/lxml/
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.",)': /pypi/simple/lxml/
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.",)': /pypi/simple/lxml/

#错误提示
Could not fetch URL https://mirrors.aliyun.com/pypi/simple/lxml/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='mirrors.aliyun.com', port=443): Max retries exceeded with url: /pypi/simple/lxml/ (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 lxml (from versions: none)
ERROR: No matching distribution found for lxml

在使用pip 或者pip3 install 库或者* 爬虫爬取HTTPs*时
有时SSL报错
查看最根源的错误是**“Can’t connect to HTTPS URL because the SSL module is not available.”**

**可以直接将相应镜像地址设置为信任 **
pip3 install beautifulsoup4 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
也可以将阿里云镜像地址设置为信任,也可以换用国内其他镜像源

完美解决问题:

[root@iZv8e15lj6mauuZ /]# pip3 install lxml -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 
Looking in indexes: http://pypi.douban.com/simple
Collecting lxml
  Downloading http://pypi.doubanio.com/packages/bd/78/56a7c88a57d0d14945472535d0df9fb4bbad7d34ede658ec7961635c790e/lxml-4.6.2-cp36-cp36m-manylinux1_x86_64.whl (5.5 MB)
     |████████████████████████████████| 5.5 MB 60.0 MB/s 
Installing collected packages: lxml
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

docx 0.2.4 requires Pillow>=2.0, which is not installed.
Successfully installed lxml-4.6.2


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值