gpt4 book ai didi

python - 运行 theano 时编译失败 - Windows 8.1 64 位与 Anaconda python 发行版

转载 作者:太空狗 更新时间:2023-10-29 21:03:09 26 4
gpt4 key购买 nike

我正在运行使用 theano 的 lasagne/nolearn。

安装和编译theano特别困难。安装64位g++编译器后出现如下编译错误。

非常感谢您的帮助。谢谢!

使用以下命令行编译时出现问题:

C:\MinGW\bin\g++.exe -shared -g -march=corei7-avx -mcx16 -msahf -mmovbe -maes -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 --param l1-cache-size=0 --param l1-cache-line-size=0 --param l2-cache-size=256 -mtune=generic -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Users\aleja_000\Anaconda\lib\site-packages\numpy\core\include -IC:\Users\aleja_000\Anaconda\include -o C:\Users\aleja_000\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.9-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\aleja_000\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp -LC:\Users\aleja_000\Anaconda\libs -LC:\Users\aleja_000\Anaconda -lpython27
Traceback (most recent call last):
File "C:\Users\aleja_000\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3032, in run_code
===============================
C:\Users\aleja_000\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp:1:0: sorry, unimplemented: 64-bit mode not compiled in
#include <Python.h>
^

exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-1e86b04c8a9c>", line 6, in <module>
from lasagne.layers import DenseLayer
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "c:\users\aleja_000\anaconda\src\lasagne\lasagne\__init__.py", line 5, in <module>
from . import nonlinearities
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "c:\users\aleja_000\anaconda\src\lasagne\lasagne\nonlinearities.py", line 6, in <module>
from theano.tensor.nnet import sigmoid
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\aleja_000\AppData\Roaming\Python\Python27\site-packages\theano\__init__.py", line 55, in <module>
from theano.compile import (
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\aleja_000\AppData\Roaming\Python\Python27\site-packages\theano\compile\__init__.py", line 9, in <module>
from theano.compile.function_module import *
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\aleja_000\AppData\Roaming\Python\Python27\site-packages\theano\compile\function_module.py", line 17, in <module>
import theano.compile.mode
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\aleja_000\AppData\Roaming\Python\Python27\site-packages\theano\compile\mode.py", line 11, in <module>
import theano.gof.vm
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\aleja_000\AppData\Roaming\Python\Python27\site-packages\theano\gof\vm.py", line 654, in <module>
import lazylinker_c
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\aleja_000\AppData\Roaming\Python\Python27\site-packages\theano\gof\lazylinker_c.py", line 125, in <module>
preargs=args)
File "C:\Users\aleja_000\AppData\Roaming\Python\Python27\site-packages\theano\gof\cmodule.py", line 2042, in compile_str
(status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): C:\Users\aleja_000\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp:1:0: sorry, unimplemented: 64-bit mode not compiled in
. #include <Python.h>
. ^
.

最佳答案

我发现了问题所在,并想发布解决方案。这个特殊问题是因为文件 libpythonxx.a 文件在找到 pythonxx.dll 文件的同一目录中丢失(在我的例子中是 python27.dll,因此我创建了 libpython27.a 文件。

一位高贵的灵魂在 http://rosinality.ncity.net/doku.php?id=python:installing_theano 发布了安装 theano 的所有必要步骤(韩语和英语)。要生成此类文件,请将 pythonxx.dll 文件复制到临时目录并在 Windows 控制台中键入以下命令:

gendef pythonXX.dll

dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libpythonXX.a --input-def pythonXX.def

然后将生成的 libpythonxx.a 文件粘贴到与 pythonxx.dll 文件相同的目录中。

在windows中,你通常会在C:\Windows\System3下找到这个文件,但如果你像我一样使用anaconda,你会在下面找到它吗?

C:\Users\xxxxx\Anaconda\libs,xxxxx 是您的用户。

关于python - 运行 theano 时编译失败 - Windows 8.1 64 位与 Anaconda python 发行版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29995397/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com