您的位置:首页技术文章
文章详情页

theano import error (win10 python2.7)

【字号: 日期:2022-08-06 08:41:16浏览:31作者:猪猪

问题描述

因为项目需要,在win10-64位电脑上配置theano.但是一直有 import error的错误,找不到解决方法。作为一个python新手,实在搞不定,请大家不吝赐教!小女子不胜感激!

按照网上的教程,安装了anaconda2, 版本是4.2.0;用 conda install mingw libpython安装了mingw libpython;mingw版本是4.7,libpython版本是2.0修改了系统的环境变量如下:theano import error (win10 python2.7)

在系统变量中添加了PYTHONPATH 变量值为 E:AnacondaLibsite-packagestheano

在cmd窗口的起始目录下,新建了 .theanorc.txt 文件(按照教程来的)

在cmd窗口里输入pip install theano安装了theano,版本是0.9.0

在cmd中打开python,输入:import theano 之后出现错误提示信息:Traceback (most recent call last): File '<stdin>', line 1, in <module>ImportError: No module named theano

然后我在Spyder的Ipython console中输入:import theano出现了不一样的import error:Traceback (most recent call last): File '<ipython-input-1-3397704bd624>', line 1, in <module>

import theano

File 'E:Anacondalibsite-packagestheano__init__.py', line 66, in <module>

from theano.compile import (

File 'E:Anacondalibsite-packagestheanocompile__init__.py', line 10, in <module>

from theano.compile.function_module import *

File 'E:Anacondalibsite-packagestheanocompilefunction_module.py', line 18, in <module>

from theano import config, gof

ImportError: cannot import name gof如图:theano import error (win10 python2.7)

有人说可能是存在多个版本的theano,但我只安装过这个版本。用pip uninstall theano卸载了之后,又pip install theano,还是没有解决这个问题。有人说是因为有cygwin和Mingw,cygwin的环境变量path还在mingw之前,可我并没有cygwin这个包。总之试了一些方法,仍然解决不了我的问题。

不知该怎么解决,希望大家给些帮助,谢谢!

问题解答

回答1:

有没有可能是python版本的问题?cmd窗口中是python2.7.13,Spyder版本中是2.7.12theano import error (win10 python2.7)

======0408更新======之前装过python2.7.13,而anaconda自带的python是2.7.12版的,所以我把2.7.13版本的python给卸了。然后再cmd中输入python,再import theano出现了新的错误:Problem occurred during compilation with the command line below:'C:MinGWbing++.exe' -shared -g -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I'E:Anacondalibsite-packagesnumpycoreinclude' -I'E:Anacondainclude' -I'E:Anacondalibsite-packagestheanogof' -L'E:Anacondalibs' -L'E:Anaconda' -o C:UserszhouyidanAppDataLocalTheanocompiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-2.7.12-64lazylinker_extlazylinker_ext.pyd C:UserszhouyidanAppDataLocalTheanocompiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-2.7.12-64lazylinker_extmod.cpp -lpython27C:UserszhouyidanAppDataLocalTheanocompiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-2.7.12-64lazylinker_extmod.cpp:1:0: sorry, unimplemented: 64-bit mode not compiled in #include <Python.h> ^

Traceback (most recent call last): File '<stdin>', line 1, in <module> File 'E:Anacondalibsite-packagestheano__init__.py', line 66, in <module>

from theano.compile import (

File 'E:Anacondalibsite-packagestheanocompile__init__.py', line 10, in <module>

from theano.compile.function_module import *

File 'E:Anacondalibsite-packagestheanocompilefunction_module.py', line 21, in <module>

import theano.compile.mode

File 'E:Anacondalibsite-packagestheanocompilemode.py', line 10, in <module>

import theano.gof.vm

File 'E:Anacondalibsite-packagestheanogofvm.py', line 662, in <module>

from . import lazylinker_c

File 'E:Anacondalibsite-packagestheanogoflazylinker_c.py', line 127, in <module>

preargs=args)

File 'E:Anacondalibsite-packagestheanogofcmodule.py', line 2316, in compile_str

(status, compile_stderr.replace(’n’, ’. ’)))

Exception: Compilation failed (return status=1): C:UserszhouyidanAppDataLocalTheanocompiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-2.7.12-64lazylinker_extmod.cpp:1:0: sorry, unimplemented: 64-bit m. ^include <Python.h>theano import error (win10 python2.7)在Spyder中还是以前的那些错误。。。

标签: Windows系统 win10
相关文章: