BAR*_*URT 2 python gpu tensorflow lib
我在WSL 2、Ubuntu\xc2\xa022.04 (Jammy Jellyfish) 下安装了 TensorFlow,按照使用 pip 安装 TensorFlow中的说明进行操作。
\n*我还安装了适用于 Windows 的 Nvidia 驱动程序,并且在我的另一个 WSL\xc2\xa02 中,我使用 GPU 支持的模拟程序。
\n一切看起来都很好。我在安装过程中没有收到任何错误消息,但是当我在Python\xc2\xa03中导入TensorFlow时,出现以下错误:
\n2023-02-12 14:49:58.544771: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library \'libnvinfer.so.7\'; dlerror: libnvrtc.so.11.0: cannot open shared object file: No such file or directory\n2023-02-12 14:49:58.544845: W 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\n2023-02-12 14:49:58.544874: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\n
Run Code Online (Sandbox Code Playgroud)\n我搜索了我的 libnvinfer_plugin.so.7 文件:
\nsudo find / -name libnvinfer.so.7 2> /dev/null\n
Run Code Online (Sandbox Code Playgroud)\n我在这个目录中找到了它们:
\ncat /usr/lib/x86_64-linux-gnu/libnvinfer.so.7\n
Run Code Online (Sandbox Code Playgroud)\n我将此目录添加到 LD_LIBRARY_PATH 中,就像无法加载动态库 'libnvinfer.so.7'中一样,但没有任何改变。TensorFlow 仍然可以工作,但我无法使用 GPU。
\n英伟达-SMI:
\n+-----------------------------------------------------------------------------+\n| NVIDIA-SMI 515.65.01 Driver Version: 516.94 CUDA Version: 11.7 |\n|-------------------------------+----------------------+----------------------+\n| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n| | | MIG M. |\n|===============================+======================+======================|\n| 0 NVIDIA GeForce ... On | 00000000:01:00.0 Off | N/A |\n| N/A 43C P0 22W / N/A | 0MiB / 6144MiB | 0% Default |\n| | | N/A |\n+-------------------------------+----------------------+----------------------+\n\n+-----------------------------------------------------------------------------+\n| Processes: |\n| GPU GI CI PID Type Process name GPU Memory |\n| ID ID Usage |\n|=============================================================================|\n| No running processes found |\n+-----------------------------------------------------------------------------+\n
Run Code Online (Sandbox Code Playgroud)\nnvcc--版本:
\nnvcc: NVIDIA (R) Cuda compiler driver\nCopyright (c) 2005-2023 NVIDIA Corporation\nBuilt on Fri_Jan__6_16:45:21_PST_2023\nCuda compilation tools, release 12.0, V12.0.140\nBuild cuda_12.0.r12.0/compiler.32267302_0\n
Run Code Online (Sandbox Code Playgroud)\n*TensorFlow版本为:2.11.0
\n那么,我该如何解决这个问题呢?
\n我更改了版本,问题解决了:
pip install --upgrade tensorflow==2.8
Run Code Online (Sandbox Code Playgroud)
注意:当我使用 v2.10 时,我收到相同的错误消息。v2.8现已稳定。