sudo apt-get update
sudo apt-get install python3-pip python3-dev -y
sudo apt-get install build-essential make cmake cmake-curses-gui -y
sudo apt-get install git g++ pkg-config curl -y
sudo apt-get install libatlas-base-dev gfortran libcanberra-gtk-module libcanberra-gtk3-module -y
sudo apt-get install libhdf5-serial-dev hdf5-tools -y
sudo apt-get install nano locate screen -y
sudo apt-get install libfreetype6-dev -y
sudo apt-get install protobuf-compiler libprotobuf-dev openssl -y
sudo apt-get install libssl-dev libcurl4-openssl-dev -y
sudo apt-get install cython3 -y
为了方便查看相关系统信息:
sudo -H pip3 install jetson-stats
安装完成后,重启系统,可以终端输入jtop调用
wget http://www.cmake.org/files/v3.13/cmake-3.13.0.tar.gz
tar xpvf cmake-3.13.0.tar.gz cmake-3.13.0/
cd cmake-3.13.0/
./bootstrap --system-curl
make -j4
echo 'export PATH=~/cmake-3.13.0/bin/:$PATH' >> ~/.bashrc
source ~/.bashrc
Ps:如果出现
缺少:CURL_LIBRARY CURL_INCLUDE_DIR
sudo apt-get install curl
sudo apt-get install libssl-dev libcurl4-openssl-dev
大容量设备无法挂载
sudo apt-get install exfat-utils
完成以后,可以试一下:
cmake --version
可以看到安装完成的cmake版本信息
将Cuda10.2文件移到/usr/local中
sudo cp -r [目标文件的位置] [目标位置]
例如,我的文件原路径是:Download/cuda-10.2, 我的指令就应该是sudo cp -r Download/cuda-10.2 /usr/local
然后将/usr/local中的cuda-10.2中的targets解压,
sudo tar xzvf targets.tar
创建软连接:
sudo ln -s /usr/local/cuda-10.2/targets/aarch64-linux/lib lib64
sudo ln -s /usr/local/cuda-10.2/targets/aarch64-linux/include include
sudo chmod -R +x /usr/local/cuda-10.2
sudo ln -s /usr/local/cuda-10.2 /usr/local/cuda
sudo ldconfig
环境变量配置:
sudo vim ~/.bashrc
键盘输入a将进入Insert模式,然后将下方信息复制到文件末尾
export CUBA_HOME=/usr/local/cuda-10.2
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.2/bin:$PATH
然后esc退出Insert模式,然后键盘输入:wq 保存并退出
更新一下:
source ~/.bashrc
再安装一些依赖:
sudo apt-get update
sudo apt-get install cuda-toolkit-10-2
然后可以验证一下cuda:
nvcc -V
将cudnn文件中的三个deb文件拷到开发板里
然后依次执行:
sudo dpkg -i libcudnn8_8.0.0.180-1+cuda10.2_arm64.deb
sudo dpkg -i libcudnn8-dev_8.0.0.180-1+cuda10.2_arm64.deb
sudo dpkg -i libcudnn8-doc_8.0.0.180-1+cuda10.2_arm64.deb
然后修改安装路径:
sudo cp /usr/include/cudnn.h /usr/local/cuda/include/
sudo cp /usr/lib/aarch64-linux-gnu/libcudnn* /usr/local/cuda/lib64/
sudo apt-get install build-essential -y
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev -y
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff5-dev libdc1394-22-dev -y
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev -y
sudo apt-get install libxvidcore-dev libx264-dev -y
sudo apt-get install libatlas-base-dev gfortran -y
sudo apt-get install ffmpeg -y
依赖安装中出现:
解决:
sudo ln -sf /usr/local/cuda/lib64/libcudnn_adv_infer.so.8.2.1 /usr/local/cuda/lib64/libcudnn_adv_infer.so.8
sudo ln -sf /usr/local/cuda/lib64/libcudnn_ops_train.so.8.2.1 /usr/local/cuda/lib64/libcudnn_ops_train.so.8
sudo ln -sf /usr/local/cuda/lib64/libcudnn.so.8.2.1 /usr/local/cuda/lib64/libcudnn.so.8
sudo ln -sf /usr/local/cuda/lib64/libcudnn_ops_infer.so.8.2.1 /usr/local/cuda/lib64/libcudnn_ops_infer.so.8
sudo ln -sf /usr/local/cuda/lib64/libcudnn_adv_train.so.8.2.1 /usr/local/cuda/lib64/libcudnn_adv_train.so.8
sudo ln -sf /usr/local/cuda/lib64/libcudnn_cnn_infer.so.8.2.1 /usr/local/cuda/lib64/libcudnn_cnn_infer.so.8
sudo ln -sf /usr/local/cuda/lib64/libcudnn_cnn_train.so.8.2.1 /usr/local/cuda/lib64/libcudnn_cnn_train.so.8
sudo vim /etc/apt/sources.list
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
安装依赖
sudo apt-get update
sudo apt-get install libjasper1 libjasper-dev
下载文件 opencv 与opencv_contrib 的源码,版本要一致
在openccv-4.1.1中新建build文件
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/home/******/*****/opencv_contrib-4.1.1/modules ..
sudo make -j4
In file included from /home/htkt/7111Yolo/opencv-3.4.5/modules/stitching/include/opencv2/stitching.hpp:49:0,
from /home/htkt/7111Yolo/opencv-3.4.5/modules/stitching/src/precomp.hpp:59,
from /home/htkt/7111Yolo/opencv-3.4.5/build/modules/stitching/opencv_stitching_pch_dephelp.cxx:1:
/home/htkt/7111Yolo/opencv-3.4.5/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:52:12: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directoryinclude “opencv2/xfeatures2d/cuda.hpp”
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
上面的ERROR,原因是include的cuda.hpp头文件路径找不到,需要改为绝对路径。打开它提示的文件matchers.hpp,然后找到你的cuda.hpp目录,如下所示。
复制你的路径,然后替换掉include “opencv2/xfeatures2d/cuda.hpp”,比如我的路径:/home/dzh/Software/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp
fatal error: boostdesc_bgm.i: No such file or directory
https://blog.csdn.net/ben_xiao_hai_123/article/details/126262891
sudo make install
配置环境:
sudo gedit /etc/ld.so.conf.d/opencv.conf
在打开的文本中输入:
/usr/local/lib
然后保存、关闭
sudo ldconfig
sudo apt-get install libopenmpi2
sudo apt-get install libopenblas-dev
sudo apt-get install libjpeg-dev zlib1g-dev
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow
然后终端输入:
sudo pip3 install torch-1.8.0-cp36-cp36m-linux_aarch64.whl
环境配置:
gedit ~/.bashrc
末尾添加:
export OPENBLAS_CORETYPE=ARMV8
source ~/.bashrc
cd到torchvision文件夹中,然后:
sudo python3 setup.py install
export BUILD_VERSION=0.9.0
python3 setup.py install --user
测试:
python3
import torch
import torchvision
import未报错就说明ok了
sudo pip3 install matplotlib==3.2.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
sudo pip3 install --upgrade Cython
sudo apt-get remove python-numpy
sudo pip3 install numpy==1.19.4
sudo pip3 install scipy==1.4.1.
sudo pip3 install tqdm==4.61.2
sudo pip3 install seaborn==0.11.1
sudo pip3 install scikit-build==0.11.1
sudo pip3 install tensorboard==2.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
这里会因为python版本低于3.7报错,可以尝试降低protobuf的版本:
sudo pip3 install protobuf==3.19.6
sudo pip3 install PyYAML==5.4.1
sudo pip3 install thop
sudo pip3 install pycocotools
如果网不好会经常因为ReadTimeoutError下载失败,可以考虑:
sudo pip3 --default-timeout=1688 install matplotlib==3.2.2 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
–default-timeout=1688 就是让其检测延迟的时间变长,以防止因为网络问题而直接报错