python解决使用镜像源来安装包
一、问题
在进行python包安装的时候出现一个问题就是无法进行安装,且出现了如下的错误
报错代码
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000018D8B602160>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000018D8C9B5940>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000018D8C9B5B70>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000018D8C9B5DD8>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000018D8C9B5BE0>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/pip/
二、解决
上面的原因是因为寝室网的问题,出现了链接超时或者是无法访问外网的原因,比如无法进入python的官网,这个就是问题的原因 。解决办法:
1.换一个网络
2.使用镜像地址,比如清华园,或者是豆瓣等镜像文件这样就可以进行下载以及正确的安装了。
指令:【pip install [包名] -i http://pypi.douban.com/simple --trusted-host pypi.douban.com】
三、结果
四、拓展
1.配置镜像文件这样就可以直接使用pip的指令来完成包的安装和数据的升级
2.首先在cmd中输入set,查看userprofile的位置,一般就在系统盘(C盘)下面的USER
3.在该目录下面建立一个pip的文件夹
4.在该文件下面建立一个pip.ini的文件
5.在该文件中写入如下内容,然后在保存。
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=tsinghua.edu.cn
结果图:
6.检验安装一个selenium和pip升级的,据此解决了前面遇到的问题
五、总结
可以看见使用命令就是【pip install [包名] -i [镜像源]】,或者使用一劳永逸法,注:如果http报错,就使用https协议
下面列举一些镜像源
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
python解决使用镜像源来安装包的更多相关文章
- Python:更改pip镜像源的方法
windows系统一步更换 在命令提示符中运行 pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ 具体其它 ...
- 更换Python默认软件镜像源
限于一些众所周知的原因,在我们pip安装软件的时候出现类似报错: data = self.read(amt=amt, decode_content=decode_content) File " ...
- Python: 解决pip安装源被墙的问题
pip install <package> -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.c ...
- python 配置pip镜像源
在本地用户下新建pip文件夹,新建pip.ini [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trust ...
- Python镜像源集合——镜像源更改方法
python在线安装库时会较慢,那是因为python的默认镜像源在国外,因此会慢:而国内有很多可以用的python镜像源,将python镜像源更改为国内的,则可以大大加快python库的安装速度. 1 ...
- Python国内镜像源及报错解决方法
国内镜像源: 阿里云:https://mirrors.aliyun.com/pypi/simple/ 清华:https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科技 ...
- 6.python设置代理和添加镜像源介绍
为什么要修改镜像源? 一般使用python安装库,会用到pip install xxx 指令或者conda install xxx指令,因为pip和conda默认国外镜像源,这时会在Python的官方 ...
- mark LINUX_6.8 python_2.6.6 setup版本升级 python 2.7.9 安装 pip 临时使用国内镜像源库 指定模块版本 删除指定模块
简单但却又经常需要使用 网上 贴子也很多 也经常用 所以 做个mark 吧: 1首先下载python2.7.9 源tar包 源码安装 可利用linux自带下载工具wget下载,如下所示: ...
- python pip 安装使用国内镜像源
国内镜像源 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 ...
随机推荐
- Android源码分析(十七)----init.rc文件添加脚本代码
一:init.rc文件修改 开机后运行一次: chmod 777 /system/bin/bt_config.sh service bt_config /system/bin/bt_config.sh ...
- VirtualBox打开VMware虚拟机
下载安装VirtualBox 打开VirtualBox,选择新建 设置如下: 之后就可以直接打开虚拟机了.
- Streaming Systems笔记
一直心心念的<Streaming Systems>终于有了影印版本,京东110块钱果断买了,很惊喜还是彩印版本. 挖个坑,书看完后写一篇关于流式处理总结的笔记,大体翻看了一遍,总体来说流式 ...
- Alipay 支付类
本版本参考网友 <?php namespace App\Tools; class Alipay { //应用ID,您的APPID. private $appID = '111'; //商户私钥 ...
- MySQL 上亿大表优化实践
目录 背景 分析 select xxx_record语句 delete xxx_record语句 测试 实施 索引优化后 delete大表优化为小批量删除 总结 背景 XX实例(一主一从)xxx告警中 ...
- Spring Data Elasticsearch 聚合查询
如需要统计某件商品的数量,最高价格,最低价格等就用到了聚合查询,就像数据库中的group by 首先需要注入ElasticsearchTemplate @Autowired private Elast ...
- Scrapy笔记(1)- 入门篇
Scrapy笔记01- 入门篇 Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架.可以应用在包括数据挖掘, 信息处理或存储历史数据等一系列的程序中.其最初是为了页面抓取(更确切来说, ...
- Pandas | 15 窗口函数
为了处理数字数据,Pandas提供了几个变体,如滚动,展开和指数移动窗口统计的权重. 其中包括总和,均值,中位数,方差,协方差,相关性等.本章讨论的是在DataFrame对象上应用这些方法. .rol ...
- ABP 菜单和权限
大致操作步骤,原理之后补充. 添加菜单: 在 ContractOwner.Web.Startup.ContractOwnerNavigationProvider 的SetNavigation方法中添加 ...
- three.js 加载STL文件
注意: TrackballControls.js 和 TDSLoader.js 都引用了 three.module.js,特别注意引用的路径 比如: 直接代码咯 <!DOCTYPE html&g ...