1. 从百度下载TensorRT-5.0包:
链接:https://pan.baidu.com/s/1buOjyLE5DPh6yLKK8e9Mrg
提取码:834t
2.下载后,解压TensorRT-5.0.2.6.Ubuntu-16.04.4.x86_64-gnu.cuda-9.0.cudnn7.3.tar.gz。
3.cd /python/
4.sudo pip install tensorrt-5.0.2.6-py2.py3-none-any.whl
5.sudo pip install pycuda
6.sudo pip install onnx
7.验证:先输入python,然后输入import tensorrt及import pycuda及import onnx。
常见报错处理:
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/
注意事项:python环境要求3.5版本,以上安装和错误解决,注意根据自己的实际路径来修改。
网友评论