NVIDIA JETSON XAVIER NX jetpack4.5 简单环境配置

第一步:

更换nx的apt源,在jetpack4.5 下的Ubuntu18.04系统,应该更换的是arm的源

%%打开
sudo vim /etc/apt/sources.list

%%vim进去之后将原来的注释,并将接下来的链接放进去
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main universe restricted
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main universe restricted

%%更新源
sudo apt-get update

第二步:

设置cuda的链接

vi ~/.bashrc
export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_ROOT=/usr/local/cuda
source ~/.bashrc
%%检查cuda版本
nvcc -V

%%查看cudnn信息
cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

第三步:

更换pip3源为清华源

%%进root
sudo su

%%安装pip3
apt install python3-pip

%%创建pip更换源的文件
mkdir ~/.pip
 vim ~/.pip/pip.conf

%%在文件中添加
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

也可以在每一次安装的时候指定源:

pip3 install 21 -i https://pypi.tuna.tsinghua.edu.cn/simple/

%%21这里就是你要装的包的名字

第四步:

根据官方论坛给出的jetpack4.5安装步骤,安装依赖包。这里我就在默认的python环境下安装。

sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran
sudo apt-get install python3-pip
sudo pip3 install -U pip testresources setuptools==49.6.0
sudo pip3 install -U numpy==1.16.1 future==0.18.2 mock==3.0.5 h5py==2.10.0 keras_preprocessing==1.1.1 keras_applications==1.0.8 gast==0.2.2 futures protobuf pybind11
# TF-2.x
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v45 tensorflow
# TF-1.15
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v45 'tensorflow<2'

第五步:

由于正在做的项目需要一些特定版本的python包,现在安装这些。

scipy==1.2.1
numpy==1.17.0
Keras==2.1.5
matplotlib==3.1.2
tqdm==4.60.0
Pillow==8.2.0
h5py==2.10.0

安装h5py可能出错,执行 sudo apt-get install python3-h5py

安装matplotlib可能出错,这里直接使用本地安装的安装方式。

链接:https://pan.baidu.com/s/1hFP_4aXAyIengztJji9vOw?pwd=2121 
提取码:2121 

pip install matplotlib-3.3.4-cp36-cp36m-linux_aarch64.whl

使用jetpack中已经安装在 conda虚拟python环境下的opencv_python方法:

将 /usr/lib/python3.6/dist-packages/cv2/python-3.6 路径下的 
cv2.cpython-36m-aarch64-linux-gnu.so 文件 复制到路径 
/home/jetson/archiconda3/envs/‘虚拟环境名称’/lib/python3.6 下。
%%终端命令如下
sudo cp /usr/lib/python3.6/dist-packages/cv2/python-3.6/cv2.cpython-36m-aarch64-linux-gnu.so /home/jetson/archiconda3/envs/tg/lib/python3.6

一些能用到的链接:

【全部为转载】

(4条消息) [NVIDIA Jetson Xavier Nx][1]---从装机到基于自带opencv4的简单demo_Little Grey的博客-CSDN博客

TensorFlow for Jetson TX2! - Jetson & Embedded Systems / Jetson TX2 - NVIDIA Developer Forums

(4条消息) Nvidia Jetson nano 安装Archiconda、gpu版torch、踩坑记录_不知名码农-的博客-CSDN博客_archiconda

(4条消息) Jetson TX2上配置archiconda、Yolov5、tensorrtx环境问题记录_深度大白的博客-CSDN博客_tx2 yolov5

(4条消息) Jetson AGX Xavier安装Archiconda虚拟环境管理器与在虚拟环境中调用opencv_围白的尾巴的博客-CSDN博客_archiconda

你可能感兴趣的:(深度学习,人工智能,python,tensorflow,linux)