"error while loading shared libraries: libnvinfer.so.7: cannot open shared object file: No such file or directory" 当 运行 TRTorch 样本

"error while loading shared libraries: libnvinfer.so.7: cannot open shared object file: No such file or directory" when running TRTorch sample

我正在尝试使用 TRTorch 引擎编译我的 pytorch 模型。 我已经根据 this link 安装了 TRTorch。
当示例代码为 运行(使用此 link 中的以下命令)时,会出现给定错误:

sudo bazel run //cpp/trtorchexec -- $(realpath /home/TRTorch/tests/modules/alexnet_scripted.jit.pt) "(1,3,227,227)"

error while loading shared libraries: libnvinfer.so.7: cannot open shared object file: No such file or directory

此外,LD_LIBRARY_PATH 设置正确。

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/TensorRT/TensorRT-7.0.0.11/lib

更多信息:

TRTorch: latest version (python package and binary)
TensorRT: 7.0.0.11
Pytorch: 1.5.1
CUDA: 10.2
Python: 3.6

我在 TRTorch github 中提出了这个问题并使用以下方法修复了它:

sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/TensorRT/TensorRT-7.0.0.11/lib bazel run //cpp/trtorchexec $(realpath tests/models/alexnet_traced.jit.pt) "(32 3 227 227)"

问题可用 here