linux+cuda8.0+安装pytorch(踩坑经验)

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ (Anaconda下载网址)
py36
bash Anaconda3-5.2.0-Linux-x86_64.sh

如有需要可以将默认的源换成国内的清华源,由于一些原因默认的源国内下载速度过慢,在终端输入以下:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
查看修改是否成功,输入:
cat ~/.condarc

pip install msgpack
pip install msgpack-python

1.首先根据cuda的版本来安装正确的pytorch命令
cuda7.5:conda install pytorch torchvision cuda75 -c pytorch
cuda8.0:  conda install pytorch torchvision -c pytorch
cuda9.0:conda install pytorch torchvision cuda90 -c pytorch
若向安装特定版本的pytorch,例如0.4.1,cuda8.0的pytorch则运行如下命令:
conda install pytorch=0.4.1 torchvision -c pytorch(等啊等失败多试试)

pip install --no-deps torchvision==0.2.1(更新)(后面加来提速) -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install --user tensorboardX

测试:
import torch
torch.cuda.is_available()     ---(true)

import torch
# 正常没有输出
a = torch.tensor(1.)
# 正常没有输出
from torch.backends import cudnn
# 正常没有输出
cudnn.is_acceptable(a.cuda())
# 正常返回True

安装caffe:
gpu版:conda install -c defaults caffe-gpu
cpu版:conda install -c defaults caffe

py27
bash Anaconda2-5.3.1-Linux-x86_64.sh
pip install msgpack-python

conda install --offline pytorch-0.4.0-py27_cuda8.0.61_cudnn7.1.2_1.tar.bz2
注(torch-0.4.1-cp27-cp27m-linux_x86_64.whl变为torch-0.4.1-cp27-cp27mu-linux_x86_64.whl大概可用)
pip install PyHamcrest
pip install argparse
pip install torchvision==0.2.1
pip install --user tensorboardX

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值