一、anaconda配置镜像
查看源:conda config --show-sources
在Mac and Linux下:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
在Windows下,直接在user目录中创建一个pip目录,如:C:Usersxxpip,新建文件pip.ini,内容如下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
换回默认源:conda config --remove-key channels
详细:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
或者:
执行conda命令:conda config
会创建conda的配置文件,使用search everything 查找 .condarc 并打开,在里面添加
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true
To get all keys and their values:
conda config --get
To get the value of a specific key, such as channels:
conda config --get channels
To add a new value, such as http://conda.anaconda.org/mutirri, to a specific key, such as channels:
conda config --add channels http://conda.anaconda.org/mutirri
To remove an existing value, such as http://conda.anaconda.org/mutirri from a specific key, such as channels:
conda config --remove channels http://conda.anaconda.org/mutirri
To remove a key, such as channels, and all of its values:
conda config --remove-key channels
To configure channels and their priority for a single environment, make a .condarc
file in the root directory of that environment.
二、pip配置镜像
1.Linux下:
修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
2.在Windows下:
直接在user目录中创建一个pip目录,如:C:Usersxxpip,新建文件pip.ini,内容如下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
3.临时使用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
4.pip国内源:
新版ubuntu要求使用https源,要注意。
清华: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/