Tensorflow导入错误:模块'imp'没有属性'find_module'

时间:2016-06-05 21:02:10

标签: python-3.x tensorflow

我正在尝试导入tensorflow(我已经安装了14.04 LTS和tensorflow 0.8)但它显示

 atributeError: module 'imp' has no attribute 'find_module'

 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/prayalankar/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/\__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/home/prayalankar/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/\__init__.py", line 45, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/prayalankar/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/home/prayalankar/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(\__file__)])
AttributeError: module 'imp' has no attribute 'find_module'

如何进行?

1 个答案:

答案 0 :(得分:2)

似乎我在主目录中有一个imp.py,这让python的imp混乱,所以我不得不更改imp.py的名称