Windows 64位和香草Python 3.5上的Theano

时间:2016-11-11 22:12:36

标签: python windows theano

我想在Windows 10 64位和vanilla Python 3.5安装上使用Theano。这就是我陷入困境的地方:

  • 我从python.org获得了Python 3.5.2 64位版本。
  • 我从Christoph Gohlke的页面安装了NumPy 1.11.2和SciPy 0.18.1。
  • pip install theano给了我Theano 0.8.2
  • 我安装了MSYS2,然后使用Pacman安装MinGW64。
  • 我将MinGW添加到PATH。
  • D:\ Python35 \ Libs中有一个libpython35.a,虽然我没有把它放在那里。

现在我在尝试运行Theano测试或Lasagne时遇到了这些错误:

Problem occurred during compilation with the command line below:
D:\msys2\mingw64\bin\g++.exe -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -D_hypot=hypot -march=haswell -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 -mno-rdseed -mno-prfchw -mno-adx -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 -mno-mwaitx -mno-clzero -mno-pku --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=haswell -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -ID:\Python35\lib\site-packages\numpy\core\include -ID:\Python35\include -ID:\Python35\lib\site-packages\theano\gof -o C:\Users\Márton\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.5.2-64\tmpf0hafy5j\m0cee5d6551f2e027b5d68bb77d6b83a4.pyd C:\Users\Márton\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.5.2-64\tmpf0hafy5j\mod.cpp -LD:\Python35\libs -LD:\Python35 -lpython35
ERROR (theano.gof.opt): Optimization failure due to: constant_folding
ERROR (theano.gof.opt): node: Elemwise{Cast{float64}}(TensorConstant{(1, 1) of 0.5})
ERROR (theano.gof.opt): TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
  File "D:\Python35\lib\site-packages\theano\gof\opt.py", line 1772, in process_node
    replacements = lopt.transform(node)
  File "D:\Python35\lib\site-packages\theano\tensor\opt.py", line 5825, in constant_folding
    no_recycling=[])
  File "D:\Python35\lib\site-packages\theano\gof\op.py", line 970, in make_thunk
    no_recycling)
  File "D:\Python35\lib\site-packages\theano\gof\op.py", line 879, in make_c_thunk
    output_storage=node_output_storage)
  File "D:\Python35\lib\site-packages\theano\gof\cc.py", line 1200, in make_thunk
    keep_lock=keep_lock)
  File "D:\Python35\lib\site-packages\theano\gof\cc.py", line 1143, in __compile__
    keep_lock=keep_lock)
  File "D:\Python35\lib\site-packages\theano\gof\cc.py", line 1595, in cthunk_factory
    key=key, lnk=self, keep_lock=keep_lock)
  File "D:\Python35\lib\site-packages\theano\gof\cmodule.py", line 1142, in module_from_key
    module = lnk.compile_cmodule(location)
  File "D:\Python35\lib\site-packages\theano\gof\cc.py", line 1506, in compile_cmodule
    preargs=preargs)
  File "D:\Python35\lib\site-packages\theano\gof\cmodule.py", line 2183, in compile_str
    compile_stderr = decode(p_out[1])
  File "D:\Python35\lib\site-packages\theano\compat\__init__.py", line 42, in decode
    return x.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 10: invalid continuation byte

我做错了什么?

1 个答案:

答案 0 :(得分:2)

Theano文档声明他们不喜欢包含空格的路径。但他们从未意识到包含重音字母的路径也会使代码崩溃。我的Windows用户名来自我的Microsoft帐户,该帐户使用我的全名,其中包含á,我是匈牙利人。将此添加到.theanorc可解决问题。

[global]
base_compiledir = D:\theano\