去NVIDIA官网下载TensorRT,下载与自己CUDA版本相对应的TensorRT tar包,下载好后解压缩
在命令行中,我使用python可以直接导入不出现问题,但是在Pycharm中,无法直接运行,可能是和环境中配置出现的问题相关,所以将TensorRT中的链接文件.so文件进行复制到/usr/lib/文件夹中,Pycharm就可以读取相关的链接文件进行链接。
1) [endif]ImportError: libnvinfer.so.6: cannot open shared object file: Nosuch file or directory
2)ImportError: libnvonnxparser.so.6: cannot open shared object file:No such file or directory
3)ImportError: libnvonnxparser_runtime.so.6: cannot open shared objectfile: No such file or directory
4)ImportError: libnvparsers.so.6: cannot open shared object file: Nosuch file or directory
5)ImportError: libnvinfer_plugin.so.6: cannot open shared object file:No such file or directory
6)ImportError: libnvrtc.so.9.0: cannot open shared object file:No such file or directory
解决办法:
1) sudo cp TensorRT-6.01/targets/x86_64-l