美文网首页
编译好Tensorflow,import时出现“ImportEr

编译好Tensorflow,import时出现“ImportEr

作者: crazyhank | 来源:发表于2018-08-12 23:17 被阅读0次

当经过千辛万苦通过源码编译好Tensorflow后,准备试一下,出现如下错误:

>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "tensorflow/python/pywrap_tensorflow.py", line 25, in <module>
    from tensorflow.python.platform import self_check
ImportError: No module named platform

原因是你在Tensorflow的源码目录下执行,因为sys.path包含了当前目录,而当前目录中也包含了tensorflow/python/platform路径,换一个目录执行就没有这个问题了。

相关文章

网友评论

      本文标题:编译好Tensorflow,import时出现“ImportEr

      本文链接:https://www.haomeiwen.com/subject/aniebftx.html