TX2+python+pytorch install

前半部分可以参考这一篇大神的https://blog.csdn.net/qq_33869371/article/details/88168202

Installing PyTorch on TX2
Trying to install PyTorch on the TX2 for Python3.5 is a bit of a mess since you need to build from source. If you're using Python2.7 or Python3.6, NVIDIA has been kind enough to provide wheels that you can install from. I briefly mention this process and include the wheels in this repository.

However, for the TX2, sadly it isn't this simple. We need to build PyTorch from source, and the latest branch of PyTorch has trouble trying to build without NCCL.

For now, I recommend using a previous version of PyTorch such as 0.4.1 or 0.5.0.

git clone http://github.com/pytorch/pytorch
git checkout 0.4.1
cd pytorch
git submodule update --init
sudo pip install -U setuptools
sudo pip install -r requirements.txt
#python setup.py build_deps
sudo python setup.py develop
sudo python setup.py install
After this, you should be able to import torch and run some basic commands to verify that it's working.

python3
import torch
print(torch.__version__)
print(torch.cuda.is_available())
Additionally, you will most likely need TorchVision for your project, which can be installed in a slightly easier manner:

pip3 install --no-deps torchvision

//
# clone pyTorch repo
git clone http://github.com/pytorch/pytorch
cd pytorch

# install prereqs
sudo pip install -U setuptools
sudo pip install -r requirements.txt

# Develop Mode:
#python setup.py build_deps    #failed
sudo python setup.py develop

# Install Mode:  (substitute for Develop Mode commands)
sudo python setup.py install

# Verify CUDA (from python interactive terminal)
# import torch
# print(torch.cuda.is_available())
# a = torch.cuda.FloatTensor(2).zero_()
# print(a)
# b = torch.randn(2).cuda()
# print(b)
# c = a + b
# print(c)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值