卸载cuda10、cudnn7.5
查看已安装cuda
#通过dpkg命令,查看相关cuda安装的包
dpkg -l | grep -i cuda
查询出来是这些,可以根据查询出来的包来用apt-get卸载
sudo apt-get remove cuda-cublas-10-0
sudo apt-get remove cuda-repo-l4t-10-0-local-10.0.166
sudo apt-get remove cuda-toolkit-10-0
sudo apt-get remove cuda-cudart-10-0
sudo apt-get remove cuda-license-10-0
卸载cuda,我这里一次性卸载
sudo apt-get remove cuda*
查询cudnn相关已安装包
dpkg -l | grep -i cudnn
卸载cudnn
sudo apt-get remove libcudnn7*
查询nvinfer相关已安装包
dpkg -l | grep -i libnvinfer
卸载nvinfer
sudo apt-get remove libnvinfer*
查询visionwork相关已安装包(根据自己需求来选择卸载)
dpkg -l | grep -i vision
卸载visionwork
sudo apt-get remove libvisio*
查询opencv相关已安装包(根据自己需求来选择卸载)
dpkg -l | grep -i opencv
卸载opencv
sudo apt-get remove libopencv*
下载cuda9、cudnn7.1
可以去tx2的jetpack3.3版本下载相关的安装包,这里我已经下载下来了,提供链接方便你们下载
cuda9下载链接(由于太大 分卷压缩了):
https://download.csdn.net/download/ourkix/12091647
https://download.csdn.net/download/ourkix/12091663
https://download.csdn.net/download/ourkix/12091665
cudnn7.1下载:
https://download.csdn.net/download/ourkix/12091671
nvinfer下载:
https://download.csdn.net/download/ourkix/12091680
下载完成后文件是这些
cuda-repo-l4t-9-0-local_9.0.252-1_arm64.deb
libcudnn7_7.1.5.14-1+cuda9.0_arm64.deb
libcudnn7-dev_7.1.5.14-1+cuda9.0_arm64.deb
libcudnn7-doc_7.1.5.14-1+cuda9.0_arm64.deb
libnvinfer4_4.1.3-1+cuda9.0_arm64.deb
libnvinfer-dev_4.1.3-1+cuda9.0_arm64.deb
libnvinfer-samples_4.1.3-1+cuda9.0_arm64.deb
libgie-dev_4.1.3-1+cuda9.0_arm64.deb
安装cuda9、cudnn7.1
根据这些顺序来安装
安装cuda9(去到下载好解压的文件夹中,命令行输入)
sudo dpkg -i cuda-repo-l4t-9-0-local_9.0.252-1_arm64.deb
sudo apt-get install cuda-toolkit-9-0
安装cudnn
sudo dpkg -i libcudnn7_7.1.5.14-1+cuda9.0_arm64.deb
sudo dpkg -i libcudnn7-dev_7.1.5.14-1+cuda9.0_arm64.deb
sudo dpkg -i libcudnn7-doc_7.1.5.14-1+cuda9.0_arm64.deb
安装nvinfer
sudo dpkg -i libnvinfer4_4.1.3-1+cuda9.0_arm64.deb
sudo dpkg -i libnvinfer-dev_4.1.3-1+cuda9.0_arm64.deb
sudo dpkg -i libnvinfer-samples_4.1.3-1+cuda9.0_arm64.deb
安装libgie
sudo dpkg -i libgie-dev_4.1.3-1+cuda9.0_arm64.deb
配置环境变量
修改cuda的环境变量(没有gedit可以用vim)
sudo gedit ~/.bashrc
打开后,拉倒最下面,将原来的cuda10的环境变量都删除掉
写入
export CUBA_HOME=/usr/local/cuda-9.0
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-9.0/bin:/usr/local/bin/cmake:$PATH
保存退出,更新环境变量
source ~/.bashrc
测试
nvcc -V
打印出cuda9.0成功。
接下来可以编译opencv caffe-ssd等,过程可以看我相关博客。