pip install第三方包 Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pipenv/:【解决方案】

pip instal xxx 的时候总是报如下错误

 Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pipenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/pipenv/ 

 默认pip是使用Python官方的源,但是由于国外官方源经常被墙,导致不可用,我们可以使用国内的python镜像源,从而解决

 Python安装不上库的烦恼。

上网也找了很多方法,最后记录下对我这种错误肯定管用的解决方案,亲测有效~

  关键命令如下:

C:\Users\Administrator>pip install xxx -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

  做一下解释:

     1. pip install 表示通过pip 来安装某种包

     2. xxx     表示你要安装的包名,比如pipenv,jupyter等等

     3. -i http://pypi.douban.com/simple       表示将镜像地址切换为国内,这里切换到了豆瓣

常用的镜像地址有: 

扫描二维码关注公众号,回复: 9325300 查看本文章

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/ 中国科学技术大学

    4.--trusted-host pypi.douban.com    表示将指定网站设置为信任服务器

最后附上一张成功截图:

  祝大家安装成功!!!

发布了29 篇原创文章 · 获赞 46 · 访问量 8214

猜你喜欢

转载自blog.csdn.net/qq_37344125/article/details/102649897
今日推荐