运行 pip install 命令  会从网站上下载指定的python包,默认是从 https://files.pythonhosted.org/ 网站上下载。

https://files.pythonhosted.org 这是个国外的网站,遇到网络情况不好的时候,可能会下载失败,我们可以通过命令,修改pip现在软件时的源。

常见国内镜像源

清华大学(完全度和速度都很好,是一个优秀的pip镜像源) https://pypi.tuna.tsinghua.edu.cn/simple阿里云(完全度和速度也很好,是一个不错的选择)        https://mirrors.aliyun.com/pypi/simple/网易(速度比较快,但是完全度有限)    https://mirrors.163.com/pypi/simple/ 豆瓣(速度较快,但是完全度也有限)    https://pypi.douban.com/simple/ 百度云(速度较快,但是完全度也有限)             https://mirror.baidu.com/pypi/simple/中科大(速度较快,但完全度不如前面几个镜像源)    https://pypi.mirrors.ustc.edu.cn/simple/华为云(完全度和速度均中等)        https://mirrors.huaweicloud.com/repository/pypi/simple/腾讯云(速度一般,完全度也一般)    https://mirrors.cloud.tencent.com/pypi/simple/

永久修改

修改源命令

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

查看配置

pip config list

临时修改

命令语法:pip install 包名 -i 国内源地址

示例:

pip install ipython -i https://mirrors.aliyun.com/pypi/simple/

查看安装结果

ipython -V

精彩文章

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: