pip下载安装python相关库时,下载速度太慢问题的解决办法(使用 -i 参数)(附国内的源:豆瓣、清华、中科大等)

pip下载安装python相关库时,下载速度太慢问题的解决办法(使用 -i 参数)(附国内的源:豆瓣、清华、中科大等)

最近在使用pip安装python相关的库(安装pyinstaller)时,发现使用“pip install pyinstaller”命令时,下载速度太慢了,十几KB的速度,但是这个库几十兆呢啊,我可是受不了的。

于是上网百度找到了解决办法,速度一下子提了上去,开心的不得了。所以在这里分享一下。^ - ^
在这里插入图片描述

先来一波国内的源:

清华的源:https://pypi.tuna.tsinghua.edu.cn/simple

豆瓣的源:http://pypi.douban.com/simple/

中科大的源:https://pypi.mirrors.ustc.edu.cn/simple/

阿里云的源:http://mirrors.aliyun.com/pypi/simple/

临时使用方法

在使用pip进行安装时,加上国内的源即可。

例如:
pip install django -i https://pypi.tuna.tsinghua.edu.cn/simple
这样就会从清华这边的镜像去安装django了。

永久修改,永久使用

linux中,
修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
即可。

windows中,
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
即可。

pip install 安装指定版本的包

要用 pip 安装指定版本的 Python 包时,只需通过“==”操作符指定即可。

pip install beagle==0.2.0
这将会安装beagle的0.2.0版本。

发布了34 篇原创文章 · 获赞 55 · 访问量 9880

猜你喜欢

转载自blog.csdn.net/weixin_43996007/article/details/104124597