前言
上一期讨论了一下orin nx装系统,这期水一下如何配置系统环境。
一、cuda安装
先换源,我换的是清华源。首先先复制一下这个文件,之后开始执行下面代码。
sudo gedit /etc/apt/sources.list
之后把里面内容改成下面清华源
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse
顺便给一下清华源的链接ubuntu-ports | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
sudo apt-get update
sudo apt dist-upgrade
之后sudo reboot重启一下,运行。装jetpack大概要一小时左右吧,很慢
sudo apt install nvidia-jetpack
运行完之后更改bashrc
sudo gedit ~/.bashrc
在后面添加
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_ROOT=/usr/local/cuda
保存退出后
source ~/.bashrc
此时,打开终端运行nvcc可以看到
此时cuda、tensorrt、opencv等包就都自己安装完成了。
二、torch、torchvision安装
安装torch就很简单了,点开桌面jetson zoo,找到pytorch之后下载python3.8 jetpack5.1那个v2.0.0版本的。
安装给的教程依次执行
sudo apt-get install libopenblas-base libopenmpi-dev libomp-dev python3-pip
pip3 install Cython
pip3 install numpy
之后找到下载torch的那个目录,执行
pip3 install torch-2***********.whl
此时pytorch已经装完了,之后开始装torchvision。先执行下面代码
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev libopenblas-base libopenmpi-dev libopenblas-dev -y
之后去下面这个网站下载torchvision
https://download.pytorch.org/whl/torchvision/
下载0.15.1xxxxxxxx.aarch64.whl
之后再下载文件夹目录下执行
pip3 install torchvision****************.whl
这样安装会比编译快很多。