我知道这个问题已经被问了很多次,但这些建议似乎都不起作用,可能是因为我的设置有些不同:
Ubuntu 22.04
python 3.10.8
tensorflow 2.11.0
cudatoolkit 11.2.2
cudnn 8.1.0.77
nvidia-tensorrt 8.4.3.1
nvidia-pyindex 1.0.9
Run Code Online (Sandbox Code Playgroud)
home/dan/anaconda3/envs/tf/lib/python3.10/site-packages/tensorrt
在我的目录中创建了一个 conda 环境“tf”
libnvinfer_builder_resource.so.8.4.3
libnvinfer_plugin.so.8
libnvinfer.so.8
libnvonnxparser.so.8
libnvparsers.so.8
tensorrt.so
Run Code Online (Sandbox Code Playgroud)
跑步时python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
我得到
tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7';
dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory;
LD_LIBRARY_PATH: :/home/dan/anaconda3/envs/tf/lib
tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7';
dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory;
LD_LIBRARY_PATH: :/home/dan/anaconda3/envs/tf/lib
tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot …
Run Code Online (Sandbox Code Playgroud)