python theano 优化失败由于:local_dot_to_dot22

python theano Optimization failure due to: local_dot_to_dot22

我刚刚 pip 安装了 theano 并尝试 运行 theano.test()。它产生了很长的错误日志,我复制了第一部分。我还尝试了其他几个示例 - 我已经看到

"local_dot_to_dot22" 

 "ValueError: invalid token "Files\Enthought\Canopy\App\appdata\canopy1.5.2.2785.win-x86_64\Scripts" in ldflags_str: "-LC:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_64\Scripts -lmk2_core -lmk2_intel_thread -lmk2_rt" 

好几次。

我正在使用 python 2.7(树冠)、scipy 0.15.1-2 和 numpy 1.9.2-1。我对 theano 很陌生。如果您能指出正确的方向,我将不胜感激。谢谢!

EEEEEERROR (theano.gof.opt): Optimization failure due to: local_dot_to_dot22
ERROR:theano.gof.opt:Optimization failure due to: local_dot_to_dot22
ERROR (theano.gof.opt): TRACEBACK:
ERROR:theano.gof.opt:TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "c:\theano\theano\gof\opt.py", line 1737, in process_node
replacements = lopt.transform(node)
File "c:\theano\theano\tensor\blas.py", line 1776, in local_dot_to_dot22
return [_dot22(x.dimshuffle('x', 0), y).dimshuffle(1)]
File "c:\theano\theano\gof\op.py", line 647, in __call__
no_recycling=[])
File "c:\theano\theano\gof\op.py", line 918, in make_thunk
no_recycling)
File "c:\theano\theano\gof\op.py", line 836, in make_c_thunk
output_storage=node_output_storage)
File "c:\theano\theano\gof\cc.py", line 1175, in make_thunk
keep_lock=keep_lock)
File "c:\theano\theano\gof\cc.py", line 1113, in __compile__
keep_lock=keep_lock)
File "c:\theano\theano\gof\cc.py", line 1541, in cthunk_factory
key = self.cmodule_key()
File "c:\theano\theano\gof\cc.py", line 1257, in cmodule_key
compile_args=self.compile_args(),
File "c:\theano\theano\gof\cc.py", line 936, in compile_args
ret += x.c_compile_args()
File "c:\theano\theano\tensor\blas.py", line 652, in c_compile_args
return ldflags(libs=False, flags=True)
File "c:\theano\theano\tensor\blas.py", line 537, in ldflags
include_dir=include_dir)
File "c:\theano\theano\gof\utils.py", line 182, in rval
val = f(*args, **kwargs)
File "c:\theano\theano\tensor\blas.py", line 597, in _ldflags
% (t, ldflags_str))
ValueError: invalid token "Files\Enthought\Canopy\App\appdata\canopy-    1.5.2.2785.win-x86_64\Scripts" in ldflags_str: "-LC:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_64\Scripts -lmk2_core -lmk2_intel_thread -lmk2_rt"

这里的问题是由你的路径中有 spaces 引起的问题,即 Canopy 安装在 C:\Program Files\Enthought\Canopy 但 Theano 脚本不能很好地与 space 之间ProgramFiles。尝试卸载 Canopy 并在路径中没有 space 的目录中重新安装。

您还应该遵循 installing Theano on Windows 的其他说明。不幸的是,它并不像 pip install theano.

那么简单

如果你不想重新安装东西,如果它们是繁重的程序,例如影响 Window 的注册表等,你可以尝试 symbolic links

符号 link 将创建类似于文件夹快捷方式的东西,但被其他应用程序视为实际文件夹。

所以,你可以这样做:

  • 运行 cmd 作为管理员
  • 使用此命令:mklink /D "C:\LinkToProgramFiles" "C:\Program Files"

然后,您开始在 ldflags 变量中使用 "C:\LinkToProgramFiles"。