相关文件下载:

https://pan.baidu.com/s/1EkmBzPtprn-aiE0ogVyHpQ

#!/bin/bash
#tensorflow-gpu版本安装脚本

#安装驱动
#进入官网搜索对应显卡型号的驱动:
#下载地址:https://www.nvidia.com/Download/index.aspx?lang=cn
wget https://cn.download.nvidia.com/XFree86/Linux-x86_64/470.57.02/NVIDIA-Linux-x86_64-470.57.02.run
chmod +x NVIDIA-Linux-x86_64-470.57.02.run
sudo ./NVIDIA-Linux-x86_64-470.57.02.run
sudo reboot


#安装cudnn
tar xzf cudnn-10.1-linux-x64-v7.6.4.38.tgz
sudo cp cuda/include/* /usr/local/cuda-10.1/include/
sudo cp cuda/lib64/* /usr/local/cuda-10.1/lib64/

#环境变量设置
echo 'export  PATH=/usr/local/cuda-10.1/bin:$PATH' >> /etc/profile
source /etc/profile
ldconfig

#安装 TensorRT
tar xzvf TensorRT-6.0.1.5.Ubuntu-18.04.x86_64-gnu.cuda-10.1.cudnn7.6.tar.gz

cd TensorRT-6.0.1.5/python
sudo pip3 install tensorrt-6.0.1.5-cp36-none-linux_x86_64.whl

#安装UFF
cd ../uff
sudo pip3 install uff-0.6.5-py2.py3-none-any.whl

#安装graphsurgeon
cd ../graphsurgeon
sudo pip3 install graphsurgeon-0.4.1-py2.py3-none-any.whl

#配置环境变量
cd ../
sudo sh -c "echo $(pwd)/TensorRT-6.0.1.5/lib>/etc/ld.so.conf.d/TensorRT.conf"
sudo ldconfig