系统: Ubuntu 18.04
报错如下:
tensorrt : Depends: libnvinfer8 (= 8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvinfer-plugin8 (= 8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvparsers8 (= 8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvonnxparsers8 (= 8.0.1-1+cuda11.3 but it is not going to be installed
Depends: libnvinfer-bin (= 8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvinfer-dev (= 8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvinfer-plugin-dev (=8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvparsers-dev (= 8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvonnxparsers-dev (= 8 8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvinfer-samples (= 8.0.1-1+cuda11.3) but it is not going to be installed
Depends: libnvinfer-doc (= 8.0.1-1+cuda11.3) but it is not going to be installedE: Unable to correct problems, you have held broken packages.
报错原因1: TensorRT版本与cuda版本不对应
解决方法:去官网重新下对应电脑cuda的TensorRT版本;
报错原因2: 之前采用的runfile方式安装的cuda,即使版本对应正确,安装TensorRT时也会报上面的错
解决方法:重新安装cuda,采用.deb的方式安装,
先卸载已安装的cuda,参考Ubuntu18.04完全卸载CUDA_ubuntu卸载cuda_谱写的博客-CSDN博客
重新安装cuda,可参考【非常详细】Ubuntu18.04安装显卡驱动和CUDA,CUDNN流程和踩坑记录_ubuntu18.04安装cuda_�Sintol·D·Kevin的博客-CSDN博客
重装完cuda后,nvidia-smi命令可能会失效,此时还需要重装下Nvidia显卡驱动。