anaconda、pip配置國內鏡像



一、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:\Users\xx\pip,新建文件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

 

 

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

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:\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/

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM