最近看到公众号推送的文章,使用Python解决各种问题,毕竟Python就是解决问题的嘛
但是在国内pip3下载安装各种Python类库的时候,总是失败,VPN也不好使,所以干脆直接换成国内的源!
pip国内的镜像
- 阿里云 https://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/
Windows
- 直接在C盘user目录下创建 pip 目录
如: C:\Users\你的用户名\pip
- 新建 pip.ini
- 添加内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
MacOS or Linux
- 打开terminal,或item2
cd ~
或者cd
切换到用户目录- 修改
~/.pip/pip.conf
(没有就创建一个) - 添加内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
测试是否更换成功
- pip install pip // MAC下使用 pip3 install pip
- 出现下列描述,表示源更改成功
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple