玩转Jetson Nano之安装pytorch

我一直以为Jetson Nano预装了torch,结果今天一import露怯了,那就安装一下吧。

其实一点都不难装,难的是需要翻墙而已。

在这里插入图片描述

  wget https://nvidia.box.com/shared/static/j2dn48btaxosqp0zremqqm8pjelriyvs.whl -O torch-1.1.0-cp36-cp36m-linux_aarch64.whl sudo pip3 install torch-1.1.0-cp36-cp36m-linux_aarch64.whl

当然向我这么好的人一定把它放在百度云盘上,方便大家下载。不点赞的不给下。链接:https://pan.baidu.com/s/1zCfAPXhQh59-0rrZLWbUpg
提取码:1xe7

安装完了,验证一下吧

在这里插入图片描述

  import torch
    print(torch.__version__)
    print('CUDA available: ' + str(torch.cuda.is_available()))
    a = torch.cuda.FloatTensor(2).zero_()
    print('Tensor a = ' + str(a))
    b = torch.randn(2).cuda()
    print('Tensor b = ' + str(b))
    c = a + b
    print('Tensor c = ' + str(c))
    安装完了torch是不是torchvision也应该安装一下
    
    # 安装一些必要的包
    sudo apt-get install libjpeg-dev zlib1g-dev
     
    # 下载torchvision
    git clone -b v0.3.0 https://github.com/pytorch/vision torchvision
     
    # 安装torchvision
    cd torchvision
    sudo python3 setup.py install

最后测试一下torchvision

  import torchvision
     
    print(torchvision.__version__) 

原文:https://blog.csdn.net/beckhans/article/details/91386429
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45342712/article/details/95198931