转载-更换镜像源

查看conda的环境目录
conda info --envs

激活一个conda环境
conda activate envs

创建conda环境
conda create -n python==3.7

删除环境
conda remove -n name --all # name表示环境名称

1,临时使用镜像源
pip install numpy -i http://mirrors.aliyun.com/pypi/simple/

2,永久更改镜像源
通过新建pip文件夹实现,首先在文件资源管理器中搜索 %APPDATA% ,新建一个pip文件夹,新建pip.txt文件,输入以下内容

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

然后保存,更改后缀为ini,完成。

或者直接输入以下命令也可以实现永久换源

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

3,修改 conda 镜像源
(永久修改)在命令提示符中输入以下内容即可:

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

若想查看自己的 channel 有哪些,执行:

conda config --show channels

若想还原默认源,执行:

conda config --remove-key channels

4,使用pip官方源:
有时候我们会遇到第三方源找不到库的情况,这个可能是该源没有更新,导致安装失败,这个时候如果换了很多第三方源都安装不了时,我们就需要使用官方源进行安装

pip install xx -i https://pypi.org/simple

5,常用的镜像源:
(1)豆瓣:http://pypi.douban.com/simple/
(2)阿里云 http://mirrors.aliyun.com/pypi/simple/
(3)清华大学:https://pypi.tuna.tsinghua.edu.cn/simple
(4)中国科学技术大学 : https://pypi.mirrors.ustc.edu.cn/simple
————————————————
版权声明:本文为CSDN博主「XC___XC」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值