[英]Cant run tensorflow on ubuntu 16.04 using python 2.7
I have installed the tensorflow using pip in python 2.7.我已经在 python 2.7 中使用 pip 安装了 tensorflow。
When I try to test the tensorflow in python, all I get is this message:当我尝试在 python 中测试张量流时,我得到的只是这条消息:
ubuntu@ubuntu:~$ python
Python 2.7.15 |Anaconda, Inc.| (default, May 1 2018, 23:32:55)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/anto/anaconda2/lib/python2.7/site-packages/tensorflow/__init__.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/anto/anaconda2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/home/anto/anaconda2/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "/home/anto/anaconda2/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 113
class DescriptorBase(metaclass=DescriptorMetaclass):
^
SyntaxError: invalid syntax
>>>
I am currently running on:我目前正在运行:
i have tried re-install a protobuf version of python 2.7 and tensorflow 1.x this is all i get to solve this problem我已经尝试重新安装 python 2.7 和 tensorflow 1.x 的 protobuf 版本这就是我解决这个问题的全部方法
pip uninstall protobuf
and try installing pip install protobuf==3.8
pip uninstall protobuf
并尝试安装pip install protobuf==3.8
pip uninstall protobuf
and try installing pip install protobuf==3.9
pip uninstall protobuf
并尝试安装pip install protobuf==3.9
it works for me这个对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.