anaconda、pip配置國內鏡像


1、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 yeshtml

在Windows下,直接在user目錄中建立一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini,內容以下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simplelinux

換回默認源:conda config --remove-key channelsubuntu

詳細:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/bash

或者:
執行conda命令:conda config
會建立conda的配置文件,使用search everything 查找 .condarc 並打開,在裏面添加
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: trueide

 

 

https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#obtaining-information-from-the-condarc-fileui

To get all keys and their values:阿里雲

conda config --get

To get the value of a specific key, such as channels:url

conda config --get channels

To add a new value, such as http://conda.anaconda.org/mutirri, to a specific key, such as channels:spa

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:code

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.

 


2、pip配置鏡像
1.Linux下:
修改 ~/.pip/pip.conf (沒有就建立一個), 修改 index-url至tuna,內容以下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

2.在Windows下:
直接在user目錄中建立一個pip目錄,如:C:\Users\xx\pip,新建文件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/

相關文章
相關標籤/搜索