Jetson NX 配置 pytorch的问题及解决方法
目录
- Jetson NX 配置pytorch
- 添加环境变量
- 测试结果
- pytorch版本与jetpack的选择
- 参考文档
Jetson NX 配置pytorch
备注:参考博客最后安装的pytorch无法使用cuda-----目javascript前没找到原因,不知如何解决。
但是官方的教程没问题!环境情况: 系统JetPaXKQNDAck 5.0.2 --Ubuntu20.04 配置流程 安装miniconda(流程省略)conda create -n pytorch python=3.8 安装pytorch
sudo apt-get -y update;
sudo apt-get -y install autoconf bc build-essential g++-8 gcc-8 clang-8 lld-8 gettext-base gfortran-8 iputils-ping libbz2-dev libc++-dev libcgal-dev libffi-dev libfreetype6-dev libhdf5-dev libjpeg-dev liblzma-dev libncurses5-dev libncursesw5-dev libpng-dev libreadline-dev libssl-dev libSQLite3-dev libXML2-dev libXSLT-dev locales moreutils openssl python-openssl rsync scons python3-pip libopenblas-dev;
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
conda activate pytorch
pip3 install Cython
添加环境变量
export PATH=/usr/local/cuda/bin:$PATH
e编程客栈xport LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_ROOT=/usr/local/cuda
export TORCH_INSTALL=https://developer.download.nvidia.cn/compute/Redist/jp/v51/pytorch/torch-1.14.0a0+44dac51c.nv23.02-cp38-cp38-linux_aarch64.whl
python3 -m pip install --upgrade pip; python3 -m pip install aiohttp numpy=='1.19.4' scipy=='1.5.3'; python3 -m pip install --upgrade protobuf; python3 -m pip install --no-cache $TORCH_INSTALL
torchvisi开发者_开发入门on pip install torchvision
测试结果
>>> import torch >>> print(torch.__version__) >>> print('CUDA available: ' + str(torch.cuda.is_available())) >>> print('cuDNN version: ' + str(torch.backends.cudnn.version())) >>> a = torch.cuda.FloatTensor(2).zero_() >>> print('Tensor a = ' + str(a)) >>> b = torch.randn(2).cuda() >>> print(XKQNDA'Tensor b = ' + str(b)) >>> c = a + b >>> print('Tensor c = ' + str(c)) >>> import torchvision >>> print(torchvision.__version__)
配合repvgg的部署 pip install opencv-contrib-python
pip install matplotlib
pip install torchvision
其他问题
报错:
ImportError: cannot import name ‘PILLOW_VERSION’ frandroidom ‘PIL’ (/home/jiajie/anaconda3/envs/py35/lib/python3.7/site-packages/PIL/init.py)
解决:
pip index versions pillow
or conda search pillow
pip3 install pillow==6.2.0
警告:
UserWarning: Failed to load image Python extension:
warn(f"Failed to load image Python extension: {e}")
解决:
没解决,据说是pytorch版本太高,或者是pytorch与torchvision版本不契合pytorch版本与jetpack的选择
安装pytorch 中第7步,不同版本的jetpack需要根据情况修改版本,
https://developer.download.nvidia.com/compute/redist/jp
参考文档
官方教程–还得是官方啊
参考博客1
参考博客2
官方提供的离线包
pytorch/vision
到此这篇关于Jetson NX 配置 pytorch的文章就介绍到这了,更多相关Jetson NX 配置 pytorch内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!
精彩评论