配置Tensorflow以及Pytorch源——以Pytorch安装为例

由于现在开始对于外网进行限制,因此一般的方法进行Tensor flow安装或者Pytorch安装会出现网速特别慢以至于安装失败的时候(经常这样),因此我们最好改变安装源来让下载快一点(由国外的源改成国内的)

 

国内的镜像源列表:

豆瓣(douban) http://pypi.douban.com/simple/
清华大学 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/

 

这里以阿里云为例

1. 更新源

cd ~/.pip
mkdir ~/.pip
cd ~/.pip
touch pip.conf
vim pip.conf

  在 pip.conf插入一下内容

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

  保存即可

2. 安装Pytorch

  一下代码按照自己的配置安装就可以了

1 pip install torch==1.0.1 -f https://download.pytorch.org/whl/cpu/stable # cup-only build
2 pip install torch==1.0.1 -f https://download.pytorch.org/whl/cu80/stable # cuda 8.0 build
3 pip install torch==1.0.1 -f https://download.pytorch.org/whl/cu90/stable # cuda 9.0 build
4 pip install torch==1.0.1 -f https://download.pytorch.org/whl/cu92/stable # cuda 9.2 build
5 pip install torch==1.0.1 -f https://download.pytorch.org/whl/cu100/stable # cuda 10.0 build

 

posted @ 2019-05-24 16:01  yanshuai0922  阅读(708)  评论(0编辑  收藏  举报