安装Pytorch0.4.0需要填的坑!!!

根据官网提供的旧版本的下载办法:
在这里插入图片描述

安装pytorch0.4.0:

sudo pip install torch==0.4.0 -f https://download.pytorch.org/whl/cu90/stable

但是呢,极其慢,然后还断了!!!别急,下面就给解决方案:

配置pip镜像源

由于pytorch的安装包有500M左右的大小,不设置镜像源可能因为网速问题而失败。

国内镜像源列表
豆瓣(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/
这里采用ailiyun镜像,因为服务器是阿里云的,就都用一家吧

更新源

运行一下命令:

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

保存即可

再次安装成功

在这里插入图片描述

测试下

在这里插入图片描述
成功~

猜你喜欢

转载自blog.csdn.net/qq_18649781/article/details/89848266
今日推荐