pip安装包时报错:Could not install packages due to an EnvironmentError: HTTPSConnectionPool

报错1

执行以下命令

pip install virtualenvwrapper-win

安装时报错

Collecting virtualenvwrapper-win
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001D59D1C7F98>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/virtualenvwrapper-win/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)",)': /simple/virtualenvwrapper-win/

......

Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/d3/07/7599a80e13e58e0bb561ed03c55a2a84872b64ae50cbc40d9bf7ebabbdd9/virtualenvwrapper-win-1.2.6.tar.gz (Caused by ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001D59D288AC8>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)'))

解决方法

pip install virtualenvwrapper-win -i https://pypi.douban.com/simple/ --trusted-host pypi.douban.com

报错2

 Could not fetch URL https://pypi.org/simple/pytest-pycodestyle/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pytest-pycodestyle/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)'))) - skipping

解决办法

pip install 插件名 -i 国内镜像地址 http://pypi.douban.com/simple --trusted-host pypi.douban.com,
# 举例:
pip install  pytest -i  http://pypi.douban.com/simple --trusted-host pypi.douban.com

1)http://mirrors.aliyun.com/pypi/simple/ 阿里云

2)https://pypi.mirrors.ustc.edu.cn/simple/  中国科技大学

3) http://pypi.douban.com/simple/  豆瓣

4) https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学

5)  http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学

搞定!

posted @   默默雷  阅读(1596)  评论(0编辑  收藏  举报
编辑推荐:
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示

目录导航