本文介绍了ubuntu 17.10 上的 tensorflow “巧妙"失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tensorflow 正在 1.6 版上工作,虽然 Eager Execution 不起作用,然后我通过 pip uninstall tensorflow 卸载了 tensorflow,然后通过 pip install tensorflow 安装,我在 import tensorflow as tf 时遇到指令错误(核心转储).

tensorflow was working on version 1.6, although eager execution didn't work, then I un-installed tensorflow through pip uninstall tensorflow, then installed via pip install tensorflow, I got instruction error (core dumped) upon import tensorflow as tf.

注意!我确实在卸载和安装之间巧妙地将 Ubuntu 从 17.xx 升级到 17.10.

note! I did upgrade Ubuntu from 17.xx to 17.10 artful between uninstalling and installing.

然后我做了 pip uninstall tensorflow 然后,从源代码构建 tf(丢弃所有建议的支持而不是 jemalloc),之后我得到:

then I did pip uninstall tensorflow then, built tf from source code (discarded all suggested support instead jemalloc), after which i got:

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
>>>

为什么模块不能识别平台模块?

why module doesn't recognize platform module?

推荐答案

您尝试在当前工作目录是源所在的位置时加载 Tensorflow.

Your trying to load Tensorflow while your current working directory is where the sources are.

只需在此目录外启动 python.

Just launch python outside this directory.

这是一个已知问题:https://github.com/tensorflow/tensorflow/issues/16264

这篇关于ubuntu 17.10 上的 tensorflow “巧妙"失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:24
查看更多