2015-11-13 74 views
1

當運行包含import theano Python腳本,我得到這個錯誤:在Windows上使用Theano:缺少lazylinker_ext.pyd

=============================== 
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++.exe: error: CreateProcess: No such file or directory是由缺少文件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造成的。我該如何獲得這個文件?


我在蟒蛇Python的2.7.10 X64安裝Theano如下:

conda install mingw libpython 
pip install theano 

然後,我改變了G ++編譯器即TDM-GCC MinGW Compiler,使其編譯到x64(否則我得到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:1: sorry, unimplemented: 64-bit mode not compiled in)。

回答

1

here

您是否關閉了命令窗口並打開了一個新窗口?對環境變量的更改(通過標準的Windows對話窗口)不適用於打開的命令窗口(儘管可以在打開的命令窗口中分別手動設置變量)。

如果設置環境變量沒有幫助,linked question的其他答案可能會有所幫助。