2019独角兽企业重金招聘Python工程师标准>>>
Ubuntu 配置 pip.conf 添加国内源
对于conda,添加安装包的镜像:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ conda config --set show_channel_urls yes
对于pip,添加安装包的镜像:
1. 新建文件夹和pip配置文件
cd ~
mkdir .pip
touch pip.conf
sudo chmod 755 pip.conf
gedit pip.conf
其他的配置位置:
Linux/Unix:
/etc/pip.conf
~/.pip/pip.conf
~/.config/pip/pip.conf
Mac OSX:
~/Library/Application Support/pip/pip.conf
~/.pip/pip.conf
/Library/Application Support/pip/pip.conf
Windows:
%APPDATA%\pip\pip.ini
%HOME%\pip\pip.ini
C:\Documents and Settings\All Users\Application Data\PyPA\pip\pip.conf (Windows XP)
C:\ProgramData\PyPA\pip\pip.conf (Windows 7及以后)
2. pip.conf 配置内容
[global]
index-url = http://pypi.douban.com/simple #豆瓣源,可以换成其他的源
extra-index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host =
pypi.douban.com #添加豆瓣源为可信主机,要不然可能报错
pypi.tuna.tsinghua #清华
timeout = 120
3. 其他多个源
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
作者:BigJeffWang
链接:https://www.jianshu.com/p/ac4df573b9d9
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。