pip/conda镜像源及部分库安装

1.pip镜像源

豆瓣镜像源(推荐)

以安装wxpython为例

pip install wxpython -i http://pypi.douban.com/simple

若出错,此命令变换为

pip install wxpython -i http://douban.com/simple --trusted-host pypi.douban.com

或者

pip install -i http://doubanio.com/simple/ --trusted-host pypi.doubanio.com wxpython

 其它镜像源

清华大学https://pypi.tuna.tsinghua.edu.cn/simple/

阿里云http://mirrors.aliyun.com/pypi/simple/

中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/

中国科学技术大学http://pypi.mirrors.ustc.edu.cn/simple/

永久置换pip镜像源

1.创建pip.conf文件

运行以下命令

cd ~/.pip

 如果提示目录不存在的话,我们要自行创建一个,再进入目录

mkdir ~/.pip
cd ~/.pip

在.pip目录下创建一个pip.conf文件

touch pip.conf

2.编辑pip.conf文件

sudo gedit ~/.pip/pip.conf

 打开pip.conf文件窗口,将以下内容复制到文件中

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

这样就替换成功,也可以选择其他镜像源

2.conda 镜像源

2.1 Linux换源

打开终端,输入命令

gedit ~/.condarc

然后填入下面的内容

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

替换成功

3.部分库安装

3.1 linux下

pytorch 官网给的代码如下:

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

其中,-c pytorch参数指定了conda获取pytorch的channel,在此指定为conda自带的pytorch仓库。
因此,只需要将-c pytorch语句去掉,就可以使用清华镜像源快速安装pytorch了

conda install pytorch torchvision cudatoolkit=9.0 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HHXC浩瀚星辰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值