gpt4 book ai didi

python - Tensorflow 无法识别 cudart64_101.dll

转载 作者:行者123 更新时间:2023-12-03 11:05:01 25 4
gpt4 key购买 nike

我在路径中有一个 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

这是为什么?我该如何解决?

最佳答案

就我而言,问题出在 python 是从 安装的。 Windows 商店 !
@smreichlingtensorflow's GitHub (issue 36111) 的评论:

The problem turned out to be that the version of python I had installed was the one from the Microsoft Store and not the one from python.org. As it turns out, apps installed from the Microsoft Store are sandboxed. Windows restricts where they can load DLLs from pretty severely. Among the restrictions: Windows does not search the directories in the PATH env var for the DLLs. So app store python will never be able to find CUDA DLLs this way.


所以我安装了可以从 https://www.python.org 下载的那个.

关于python - Tensorflow 无法识别 cudart64_101.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60636785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com