gpt4 book ai didi

python - 在 Windows 上安装 Theano - DLL 加载失败

转载 作者:太空狗 更新时间:2023-10-29 22:15:28 28 4
gpt4 key购买 nike

我正在尝试在 Windwos 8 上安装 Theano

已关注these步骤。

我尝试使用:

import numpy as np
import time
import theano

print('blas.ldflags=', theano.config.blas.ldflags)
A = np.random.rand(1000, 10000).astype(theano.config.floatX)
B = np.random.rand(10000, 1000).astype(theano.config.floatX)
np_start = time.time()
AB = A.dot(B)
np_end = time.time()
X, Y = theano.tensor.matrices('XY')
mf = theano.function([X, Y], X.dot(Y))
t_start = time.time()
tAB = mf(A, B)
t_end = time.time()
print("NP time: %f[s], theano time: %f[s] (times should be close when run on CPU!)" % (
np_end - np_start, t_end - t_start))
print("Result difference: %f" % (np.abs(AB - tAB).max(), ))

我知道该脚本是 numpy 和 theano 计算时间之间的比较。

但是不知何故,找不到某些dll。请找到以下日志:

[Py341] C:\>python ML\Deep\TheanoSetupTesting.py
blas.ldflags= -LE:\Things_Installed_Here\Theano\openblas -lopenblas
Traceback (most recent call last):
File "ML\Deep\TheanoSetupTesting.py", line 12, in <module>
mf = theano.function([X, Y], X.dot(Y))
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\compile\function.py", line 317, in function
output_keys=output_keys)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\compile\pfunc.py", line 526, in pfunc
output_keys=output_keys)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\compile\function_module.py", line 1778, in orig_function

defaults)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\compile\function_module.py", line 1642, in create input_storage=input_storage_lists, storage_map=storage_map)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\link.py", line 690, in make_thunk
storage_map=storage_map)[:3]
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\vm.py", line 1037, in make_all
no_recycling))
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\op.py", line 932, in make_thunk
no_recycling)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\op.py", line 850, in make_c_thunk
output_storage=node_output_storage)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cc.py", line 1207, in make_thunk
keep_lock=keep_lock)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cc.py", line 1152, in __compile__
keep_lock=keep_lock)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cc.py", line 1602, in cthunk_factory
key=key, lnk=self, keep_lock=keep_lock)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cmodule.py", line 1174, in module_from_key module = lnk.compile_cmodule(location)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cc.py", line 1513, in compile_cmodule
preargs=preargs)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cmodule.py", line 2196, in compile_str
return dlimport(lib_filename)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cmodule.py", line 331, in dlimport
rval = __import__(module_name, {}, {}, [module_name])
ImportError: DLL load failed: The specified module could not be found.

作为 python 世界的新手,我无法找出未找到的 Dll。如果丢失,我会安装它,并将路径添加到系统路径变量中。但是我怎么知道它是哪个dll。我尝试使用 pdb 并在不同位置的 cmodule.py 中设置断点,但没有命中。

  1. 您是否熟悉此类错误及其解决方法?
  2. 否则,帮我找到丢失的 dll 名称,剩下的由我来做。
  3. 我不介意在安装 theano 时走完全不同的道路。我遇到了几篇暗示微软编译器工作正常的帖子。但是我已经连续 14 个小时解决了一个问题,并且想要一种有效的方法。最终,我希望在我的系统上使用 theano

顺便说一句,没有CUDA。我只在 CPU 上尝试。

最佳答案

这可能有点晚了。我遵循了与您完全相同的指南,但遇到了同样的错误。

事实证明,可以通过将 openblas 目录添加到系统路径来修复它。在您的示例中,将“E:\Things_Installed_Here\Theano\openblas”添加到系统路径变量。

请注意,根据放置 DLL 文件的位置,您需要添加“E:\Things_Installed_Here\Theano\openblas”或“E:\Things_Installed_Here\Theano\openblas\bin”。

Windows 10 64 位、Python 3.5.1 (Anaconda 2.5)、Theano 0.8.2。

对于那些需要它的人,由于这三个指南,我能够在 Windows 10 中安装 Theano guide1 , guide2以及 OP 所附的指南。

关于python - 在 Windows 上安装 Theano - DLL 加载失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34508431/

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