pip uninstall tensorflow
卸载了tensorflow,然后通过pip install tensorflow
安装,我在import tensorflow as tf
上收到指令错误(核心转储) {1}}。
请注意!在卸载和安装之间,我确实将Ubuntu从17.xx升级到17.10。
然后我做pip uninstall tensorflow
然后,从源代码构建tf(丢弃所有建议的支持而不是jemalloc
),之后我得到了:
root@commandor:/opt/tf/sc/tensorflow# python
Python 2.7.14 (default, Sep 23 2017, 22:06:14)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 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 * # pylint: disable=redefined-builtin
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
>>>
为什么模块无法识别平台模块?
答案 0 :(得分:2)
您尝试加载Tensorflow,而当前的工作目录是源代码。
只需在此目录外启动python。
这是一个众所周知的问题:https://github.com/tensorflow/tensorflow/issues/16264