一、问题
在进行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. js点击按钮button效果(波效果)

    Material Design风格纯js按钮点击波特效 演示效果 html部分: <button data-ripple> Demo button 6 </button> cs ...

  2. PHP生成json

    索引数组 <?php //json_encode(数组/对象) $color = array('red','blue','green'); echo json_encode($color); / ...

  3. CDH报错:ScmActive at bootup: Failed to validate the identity of Cloudera Manager.

    报错原因以及解决办法在官网: https://www.cloudera.com/documentation/enterprise/5-8-x/topics/cm_failover_db.html 1. ...

  4. Maven打包时出现“Show Console View”错误弹出框,错误详情为“An internal error has occurred. java.lang.NullPointerException”的解决方法

    今天为项目打包时出现了下面的错误提示: 打开Details里面写的是“An internal error has occurred. java.lang.NullPointerException”.在 ...

  5. 遇到的一个Buffer too small问题

    在ROI中输出图像时遇到 经调试后发现是driver.Create时设置的波段数大于实际写入的波段数导致的 这里xImgIn.m_nBands有204,但实际写入的数据的bands只有3,修改时忘了修 ...

  6. Ubuntu18.04 Pycharm下ModuleNotFoundError: No module named 'deeplab'

    1.根据https://www.cnblogs.com/zmbreathing/p/deeplab_v3plus.html在终端中成功运行deeplab的test文件后,在pycharm中出现问题: ...

  7. Chrome无界面启动使用

    Method1: from selenium import webdriver # 创建chrome参数对象opt = webdriver.ChromeOptions() # 把chrome设置成无界 ...

  8. msyql常用命令

    1.创建.删除数据库 create database dbname; drop database dbname; 2.选择某一个数据库 use dbname; 3.显示所有表 show tables; ...

  9. 201871010109-胡欢欢《面向对象程序设计(java)》第四周学习总结会

    项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nwnu-daizh/p ...

  10. nginx访问限制

    nginx的访问控制 1.http_access_module   基于ip的访问控制 允许的访问配置 不允许的访问配置 server { listen 80; server_name localho ...