ubuntu16.04安装tensorrt5.1.5.0踩坑实录

直接上步骤:
1、anaconda创建一个tensorrt的环境:
conda create --name=tensorrt python=3.5
2、官网的步骤安装,官网见参考链接,我使用的是tar包安装,都是选择pip3的选项安装
3、激活环境,输入python3,进入python3.5(别的版本总是报错,要不就是不报错,但import不到),然后import tensorrt,然后开始报错,排错部分参照如下:
常见报错处理:
1) [endif]ImportError: libnvinfer.so.5: cannot open shared object file: Nosuch file or directory
2)ImportError: libnvonnxparser.so.0: cannot open shared object file:No such file or directory
3)ImportError: libnvonnxparser_runtime.so.0: cannot open shared objectfile: No such file or directory
4)ImportError: libnvparsers.so.5: cannot open shared object file: Nosuch file or directory
5)ImportError: libnvinfer_plugin.so.5: cannot open shared object file:No such file or directory
解决办法:
1) sudo cp …/TensorRT-5.0.2.6/targets/x86_64-linux-gnu/lib/libnvinfer.so.5 /usr/lib/
2)sudo cp …/TensorRT-5.0.2.6/targets/x86_64-linux-gnu/lib/libnvonnxparser.so.0/usr/lib/
3) sudo cp …/TensorRT-5.0.2.6/targets/x86_64-linux-gnu/lib/libnvonnxparser_runtime.so.0 /usr/lib/
4) sudo cp …/TensorRT-5.0.2.6/targets/x86_64-linux-gnu/lib/libnvparsers.so.5 /usr/lib/
5) sudo cp …/TensorRT-5.0.2.6/targets/x86_64-linux-gnu/lib/ libnvinfer_plugin.so.5 /usr/lib/
4、再次import tensorrt 成功!

参考链接:
1、https://docs.nvidia.com/deeplearning/sdk/tensorrt-install-guide/index.html#installing-tar
2、https://www.jianshu.com/p/eb18fe0caa9d

你可能感兴趣的:(Linux)