我在路径 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\cudart64_101.dll
中有一个DLL文件,但是 TensorFlow
似乎无法识别它:
2020-03-11 14:39:19.815880: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
我确保在PATH变量中包含DLL的路径:
>>> l = os.environ['PATH'].split(';')
>>> for s in l:
... print(s)
...
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
奇怪的是,如果我使用
ctypes
手动包含它,它可以被成功加载:>>> import ctypes
>>> hllDll = ctypes.WinDLL("C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin\\cudart64_101.dll")
>>> import tensorflow as tf
2020-03-11 15:05:26.907300: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
为什么会出现这种情况?我该如何解决?