在Windows上使用Theano:缺少lazylinker_ext.pyd

在Windows上使用Theano:缺少lazylinker_ext.pyd,windows,theano,Windows,Theano,运行包含import theano的Python脚本时,出现以下错误: =============================== 00001 #include <Python.h> 00002 #include "structmember.h" 00003 #include <sys/time.h> 00004 00005 // Old Python compatibility from here: 00006 // http://www.

运行包含
import theano
的Python脚本时,出现以下错误:

===============================
00001   #include <Python.h>
00002   #include "structmember.h"
00003   #include <sys/time.h>
00004   
00005   // Old Python compatibility from here:
00006   // http://www.python.org/dev/peps/pep-0353/
[...]
01077       return RETVAL;
01078   }
01079   
01080   
Problem occurred during compilation with the command line below:
C:\programming\cpp\gcc-4.9.2-tdm-1-core\bin\g++.exe -shared -g -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Anaconda\lib\site-packages\numpy\core\include -IC:\Anaconda\include -o C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\mod.cpp -LC:\Anaconda\libs -LC:\Anaconda -lpython27
===============================
g++.exe: error: CreateProcess: No such file or directory

Traceback (most recent call last):
  File "C:\Users\Francky\Documents\GitHub\nlp\6864project\code\theano\eval_dialog_cat.py", line 7, in <module>
    import theano 
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\__init__.py", line 55, in <module>
    from theano.compile import \
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\__init__.py", line 9, in <module>
    from theano.compile.function_module import *
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\function_module.py", line 18, in <module>
    import theano.compile.mode
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\vm.py", line 568, in <module>
    import lazylinker_c
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\lazylinker_c.py", line 116, in <module>
    preargs=args)
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\cmodule.py", line 2010, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. ception: Compilation failed (return status=1): g++.exe: error: CreateProcess: No such file or directory
然后我更改了g++编译器,即将其编译为x64(否则我会得到
C:\Users\Francky\AppData\Local\Theano\compiledir\u Windows-7-6.1.7601-SP1-Intel64\u Family\u 6\u Model\u 58\u GenuineIntel-2.7.10-64\lazylinker\u ext\mod.cpp:1:对不起,未实现:64位模式未在
中编译)

您是否关闭了命令窗口并打开了一个新窗口?对环境变量的更改(通过标准Windows对话窗口)将不适用于打开的命令窗口(不过,您可以在打开的命令窗口中单独或手动设置变量)


如果设置环境变量没有帮助,那么其他答案可能会有所帮助。

我已经花了几天时间在这方面。最终,在将我的G++编译器更改为64位(我使用的)之后,我不得不更新theano。Windows“where”命令可以很容易地查看g++的安装位置:其中g++提供了包括32位版本在内的多个位置

conda install mingw libpython
pip install theano