一 Windows系统:
1. 临时修改源
在使用pip的时,加上 -i
参数,指定pip源。
$ pip install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple
这是清华大学的源,你可以根据自己情况,更换其他的源。
2. 永久修改
打开文件夹 C:\Users\用户名\AppData\Roaming
在下面新建 pip
文件夹,之后,在pip目录下新建一个文本文件,改名为(包括扩展名) pip.ini
pip.ini 中的文件内容为:
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
可根据实际情况修改为其它源
3. 国内的一些pip源
- 阿里云 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/]
二 Linux/Unix 系统
在家(home)目录下,创建一个 .pip
文件夹,进入该文件夹,创建一个文本文件:pip.conf
,如果有直接修改即可
在文件中输入:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple