![](/img/trans.png)
[英]TensorFlow / Keras Error : dlerror: cudart64_101.dll not found
[英]Tensorflow not recognising cudart64_101.dll
我在路徑中有一個 DLL 文件: C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin\\cudart64_101.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
這是為什么? 我該如何解決?
就我而言,問題出在從Windows 商店安裝的 python !
請參閱@smreichling在tensorflow 的 GitHub 上的評論(問題 36111) :
問題原來是我安裝的 python 版本是來自 Microsoft Store 的版本,而不是來自 python.org 的版本。 事實證明,從 Microsoft Store 安裝的應用程序是沙盒化的。 Windows 非常嚴格地限制了它們可以從何處加載 DLL。 其中的限制是:Windows 不會在
PATH
變量中搜索 DLL 的目錄。 所以應用商店 python 永遠無法通過這種方式找到 CUDA DLL。
所以我安裝了可以從https://www.python.org下載的那個。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.