修改python的pip源
修改python的pip源
前言
我这里是Windows10/11专业工作版(其他Windows版本也适用)
如果你的设备是已经是结束支持的Windows7,请查阅其他相关是手册
什么是pip
pip 是 Python 包管理工具,该工具提供了对Python 包的查找、下载、安装、卸载的功能。
目前如果你在 python.org 下载最新版本的安装包,则是已经自带了该工具。
注意:Python 2.7.9 + 或 Python 3.4+ 以上版本都自带 pip 工具。
修改pip
在使用Python安装包工具pip时经常会出现下载很慢的情况,这其中有很大一部分原因和pip的源有关.
在我们安装python后,通常python解释器自带pip这个工具,但是这里pip是设置的默认源,也就是官方源:
https://pypi.org/simple
这个源在国内的下载速度是很慢的,所以我们为了提高包的下载速度我们可以通过换源来实现。
Python pip国内源路径
阿里云 http://mirrors.aliyun.com/pypi/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
临时修改
打开终端,在终端输入下面的换源代码
换为清华源
1 | pip install markdown -i https://pypi.tuna.tsinghua.edu.cn/simple |
换为阿里源
1 | pip install markdown -i https://mirrors.aliyun.com/pypi/simple/ |
换为腾讯源
1 | pip install markdown -i http://mirrors.cloud.tencent.com/pypi/simple |
换为豆瓣源
1 | pip install markdown -i http://pypi.douban.com/simple/ |
永久修改
打开终端,在终端输入下面的换源代码
换为清华源
1 | pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple |
换为阿里源
1 | pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple |
换为腾讯源
1 | pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple |
换为豆瓣源
1 | pip config set global.index-url http://pypi.douban.com/simple/ |
修改为默认
1 | pip config unset global.index-url |
结语
1、打开终端
2、复制你要选择的pip源的修改代码
3、粘贴到终端
此文章版权归曦曦所有,如有转载,请注明来自原作者




