win10换源(包括conda、pip)

510 阅读1分钟

一、更换conda源

打开CMD,输入:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

删除该源:

conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

查看该源:

conda config --show

该源在本地的文件:C:\Users\XXX下的.condarc文件


其他可选的源

中科大源:conda config –add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ 
阿里云源:conda config --add channels http://mirrors.aliyun.com/pypi/simple/



二、更换pip源

C:\Users\XXX 下新建一个文件夹,重命名为 pip。


在pip文件夹里面新建一个文本文档,并重新命名为: pip.ini ,需要修改后缀。


在pip.ini里面添加下面的信息

[global]
index-url = http://mirrors.aliyun.com/pypi/simple
[install]
trusted-host = mirrors.aliyun.com

按照掐头去尾的规律(trusted-host为去掉【https://】和【/后面内容】的index-url),可更换其他的

清华源index-url:https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣源index-url:http://pypi.douban.com/simple/
中科大源index-url: http://pypi.mirrors.ustc.edu.cn/simple/



conda常用命令

conda info --env   查看所有环境
conda create -n test python=3.7   创建新环境

重命名环境
conda create -n hsy --clone test   克隆式创建
conda remove -n test --all         删除原环境