我从github下载theano并安装它。但是当我尝试在ipython中导入theano时,我遇到了这个问题。
In [1]: import theano
ImportError Traceback (most recent call last) <ipython-input-1-3397704bd624> in <module>() ----> 1 import theano
C:\Anaconda3\lib\site-packages\theano\__init__.py in <module>() 40从theano.version导入版本为版本 41 ---> 42 from theano.configdefaults import config 43 44 # This is the api version for ops that generate C code. External ops
C:\Anaconda3\lib\site-packages\theano\configdefaults.py in <module>() 14 15 import theano ---> 16 from theano.configparser import (AddConfigVar, BoolParam, ConfigParam, EnumStr, 17 FloatParam, IntParam, StrParam, 18 TheanoConfigParser, THEANO_FLAGS_DICT)
C:\Anaconda3\lib\site-packages\theano\configparser.py in <module>() 13 14 import theano ---> 15 from theano.compat import configparser as ConfigParser 16 from six import string_types 17
C:\Anaconda3\lib\site-packages\theano\compat\__init__.py in <module>() 4 # Python 3.x compatibility 5 from six import PY3, b, BytesIO, next ----> 6 from six.moves import configparser 7 from six.moves import reload_module as reload 8 import collections
C:\Anaconda3\lib\site-packages\six.py in __get__(self, obj, tp) 90 91 def __get__(self, obj, tp): ---> 92 result = self._resolve() 93 setattr(obj, self.name, result) # Invokes __set__. 94 try:
C:\Anaconda3\lib\site-packages\six.py in _resolve(self) 113 114 def _resolve(self): --> 115 return _import_module(self.mod) 116 117 def __getattr__(self, attr):
C:\Anaconda3\lib\site-packages\six.py in _import_module(name) 80 def _import_module(name): 81 """Import module, returning the module after the last dot.""" ---> 82 __import__(name) 83 return sys.modules[name] 84
当我进入C:\Anaconda3\Lib\site-packages\theano\configparser.py in <module>() 13 14 import theano ---> 15 from theano.compat import configparser as ConfigParser 16 from six import string_types 17文件时,我确实无法在目录中找到configparser.py,但是原始文件也没有它。
ImportError:无法导入名称“config分析器”
发布于 2017-05-03 08:10:47
刚刚找到了一个临时的解决方案,将configparser.py重命名为config_parser或任何其他非confilct名称。
并将每个模块的名称更改为config_parser。
https://stackoverflow.com/questions/38611999
复制相似问题