一、问题
在进行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解决使用镜像源来安装包的更多相关文章

  1. Python:更改pip镜像源的方法

    windows系统一步更换 在命令提示符中运行 pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ 具体其它 ...

  2. 更换Python默认软件镜像源

    限于一些众所周知的原因,在我们pip安装软件的时候出现类似报错: data = self.read(amt=amt, decode_content=decode_content) File " ...

  3. Python: 解决pip安装源被墙的问题

    pip install <package> -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.c ...

  4. python 配置pip镜像源

    在本地用户下新建pip文件夹,新建pip.ini [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trust ...

  5. Python镜像源集合——镜像源更改方法

    python在线安装库时会较慢,那是因为python的默认镜像源在国外,因此会慢:而国内有很多可以用的python镜像源,将python镜像源更改为国内的,则可以大大加快python库的安装速度. 1 ...

  6. Python国内镜像源及报错解决方法

    国内镜像源: 阿里云:https://mirrors.aliyun.com/pypi/simple/ 清华:https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科技 ...

  7. 6.python设置代理和添加镜像源介绍

    为什么要修改镜像源? 一般使用python安装库,会用到pip install xxx 指令或者conda install xxx指令,因为pip和conda默认国外镜像源,这时会在Python的官方 ...

  8. mark LINUX_6.8 python_2.6.6 setup版本升级 python 2.7.9 安装 pip 临时使用国内镜像源库 指定模块版本 删除指定模块

    简单但却又经常需要使用  网上  贴子也很多  也经常用  所以 做个mark 吧: 1首先下载python2.7.9 源tar包 源码安装 可利用linux自带下载工具wget下载,如下所示:   ...

  9. python pip 安装使用国内镜像源

    国内镜像源 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 ...

随机推荐

  1. Android中webview html5 自动播放本地视频

    MainActivity代码 public class Html5VideoAutoPlay extends Activity { WebView webview = null; @Override ...

  2. 个人项目-wc

    个人项目-WC   (C语言) 一.Github地址:https://github.com/Lin-J-F/WC 二.PSP表格 PSP2.1 Personal Software Process St ...

  3. windows10删除多出的oem分区

    某次windows升级后,磁盘管理里新出现一个500多M的OEM分区 其实系统里本来就有一个OEM分区是第一个分区,大小499M,可能因为这个分区太小,系统就又新建一个 因为在windows10分区后 ...

  4. Linux系统运行模式介绍

    Linux运行模式 自由服务,即不需要用户独立去安装的软件服务,而是在系统安装好之后就可以直接使用的服务(内置服务). 运行模式也称为运行级别,属于linux的自有服务. 运行模式可以理解为一旦你开机 ...

  5. 快速生成mysql上百万条测试数据

    方案:编写一个存储过程循环添加数据 1. 创建表index_test DROP TABLE IF EXISTS index_test; CREATE TABLE index_test( id ) PR ...

  6. PAT 乙级 1091.N-自守数 C++/Java

    题目来源 如果某个数 K 的平方乘以 N 以后,结果的末尾几位数等于 K,那么就称这个数为“N-自守数”.例如 3,而 2 的末尾两位正好是 9,所以 9 是一个 3-自守数. 本题就请你编写程序判断 ...

  7. vue2.0 实现导航守卫(路由守卫)---登录验证

    路由跳转前做一些验证,比如登录验证,是网站中的普遍需求. 对此,vue-route 提供的 beforeRouteUpdate 可以方便地实现导航守卫(navigation-guards). 导航守卫 ...

  8. Slf4j 打日志的问题 Exception 没有堆栈信息

    Slf4j 打日志的问题 Exception 没有堆栈信息 发现线上环境有的Exception堆栈信息没打出来,只有异常信息没有堆栈信息,难以定位 一般情况下日志这么打 log.info(" ...

  9. 06-cmake语法-include

    用来载入CMakeLists.txt文件,也用于载入预定义的cmake模块. include(cmake/OpenCVMinDepVersions.cmake) .cmake 是一个文本,定义了一个模 ...

  10. getElementsByName兼容ie 但并不是兼容ie下的所有标签

    document.getElementsByName('someName') 返回一个节点列表(数组) document.getElementById('id') 返回一个节点或者null 注意在IE ...