pip和conda修改镜像源

本文详细介绍了如何在Linux和Windows系统中修改pip和conda的镜像源,包括临时使用特定源安装包的方法及永久修改配置文件的步骤。通过更换为国内镜像源,如清华、阿里云等,可以显著提升软件包的下载速度。

1.pip和conda修改镜像源的方式有所不同

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/ 

对于临时使用一下:

在pip后面加上-i参数,指定pip源

pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple


对于Linux系统

mkdir ~/.pip
cd ~/.pip
vi pip.conf

输入:
[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple/

对于windows系统

cmd
cd C:\Users\(你的用户名)
mkdir pip
cd pip
cd.>pip.ini


打开pip.ini  (在C:\Users\你的名字\pip下),输入:
[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple/

Conda修改镜像源

Linux和Windows对于conda修改镜像源的方法一样

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

conda install 随便一个模块试试,看网址是否换源成功

参考:https://blog.youkuaiyun.com/leviopku/article/details/80113021

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值