anaconda python 导入 theano 时出错

anaconda python error importing theano

我是 python 的新手,当然我也是 Theano 的新手。我正在尝试在 windows 下与 anaconda python 一起使用它。我已经安装了所有强制性要求(CUDA 除外,因为在这台笔记本电脑上我没有 NVIDIA GPU)。 我安装了相同的 GCC 并按照演练页面中的建议设置了路径。 我仍然收到以下错误:

    Problem occurred during compilation with the command line below:
C:\TDM-GCC-64\bin\g++.exe -shared -g -march=broadwell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=broadwell -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\Paolo\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_61_Stepping_4_GenuineIntel-2.7.10-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Paolo\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_61_Stepping_4_GenuineIntel-2.7.10-64\lazylinker_ext\mod.cpp -LC:\Anaconda\libs -LC:\Anaconda -lpython27
Traceback (most recent call last):
  File "C:/Users/Paolo/PycharmProjects/cvtutorial/tutorial1.py", line 5, in <module>
    import theano
  File "C:\Anaconda\lib\site-packages\theano\__init__.py", line 55, in <module>
    from theano.compile import \
  File "C:\Anaconda\lib\site-packages\theano\compile\__init__.py", line 9, in <module>
    from theano.compile.function_module import *
  File "C:\Anaconda\lib\site-packages\theano\compile\function_module.py", line 18, in <module>
    import theano.compile.mode
  File "C:\Anaconda\lib\site-packages\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "C:\Anaconda\lib\site-packages\theano\gof\vm.py", line 568, in <module>
===============================
C:\Anaconda\libs/python27.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status

    import lazylinker_c
  File "C:\Anaconda\lib\site-packages\theano\gof\lazylinker_c.py", line 116, in <module>
    preargs=args)
  File "C:\Anaconda\lib\site-packages\theano\gof\cmodule.py", line 2010, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. 

Process finished with exit code 1

有什么建议吗?

这个/\东西在

C:\Anaconda\libs/python27.lib:

我觉得很奇怪...

你读过这个link吗?

https://github.com/Theano/Theano/issues/2406

希望您能从中找到解决方案。

正如丹尼尔在评论中所建议的,我没有运行命令:

conda install mingw libpython

之后我就可以正确导入Theano了。解决了! :)