无法在IPyhon3中导入tensorflow

时间:2017-04-24 16:37:25

标签: python-3.x tensorflow ipython ubuntu-16.04

我只是粘贴我的bash shell的输出,这可能是非常明确的。运行IPython:

petrux@orion:~/Projects/dket$ ipython
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.0.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import tensorflow as tf
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-41389fad42b5> in <module>()
----> 1 import tensorflow as tf

/home/petrux/.local/lib/python3.5/site-packages/tensorflow/__init__.py in <module>()
     22 
     23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import *
     25 # pylint: enable=wildcard-import
     26 

/home/petrux/.local/lib/python3.5/site-packages/tensorflow/python/__init__.py in <module>()
     73 
     74 # Protocol buffers
---> 75 from tensorflow.core.framework.graph_pb2 import *
     76 from tensorflow.core.framework.node_def_pb2 import *
     77 from tensorflow.core.framework.summary_pb2 import *

/home/petrux/.local/lib/python3.5/site-packages/tensorflow/core/framework/graph_pb2.py in <module>()
      4 import sys
      5 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
----> 6 from google.protobuf import descriptor as _descriptor
      7 from google.protobuf import message as _message
      8 from google.protobuf import reflection as _reflection

ImportError: No module named 'google.protobuf'; 'google' is not a package
运行常规python解释器时

petrux@orion:~/Projects/dket$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> 

我正在运行Ubuntu 16.04作为操作系统。 提前谢谢。

0 个答案:

没有答案