python 3.5.2的Tensorflow SyntaxError [英] Tensorflow SyntaxError with python 3.5.2
问题描述
我正在尝试使用带有CPU支持的pip安装将tensorflow安装到具有Python 3.5的Linux系统(Linuxmint)上.安装完成后;为了验证我的安装,我尝试运行以下脚本
I'm trying to install tensorflow to my Linux systems (Linuxmint) with Python 3.5 using pip installation with CPU support. After the installation is done; to validate my installation I try to run the following script
python3
>import tensorflow as tf
结果如下:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import * File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 54, in <module> from tensorflow.core.framework.graph_pb2 import * File "/usr/local/lib/python3.5/dist-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module> from google.protobuf import descriptor as _descriptor File "/usr/local/lib/python3.5/dist-packages/pygoogle/google.py", line 118 %(__credits__)s""" % globals() ^ SyntaxError: invalid syntax
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import * File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 54, in <module> from tensorflow.core.framework.graph_pb2 import * File "/usr/local/lib/python3.5/dist-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module> from google.protobuf import descriptor as _descriptor File "/usr/local/lib/python3.5/dist-packages/pygoogle/google.py", line 118 %(__credits__)s""" % globals() ^ SyntaxError: invalid syntax
有人可以帮忙这个话题吗?
Can someone please help on the topic?
推荐答案
在将tensorflow
1.3.0升级到1.4.0之后,我遇到了此错误.要解决它,我检查了不同的步骤:
After upgrading tensorflow
1.3.0 to 1.4.0 I encountered this error. to solve it, I check different steps :
sudo pip3 uninstall tensorflow-gpu
sudo pip3 uninstall protobuf
sudo pip3 install tensorflow-gpu==1.3.0
sudo pip3 install protobuf==3.3.0
,但错误未解决.最后,我卸载了pygoogle
but the error was not resolved. finally, I uninstalled pygoogle
sudo pip3 uninstall pygoogle
它有效!希望它也对您有用.
and it works! Hope it will work for you too.
这篇关于python 3.5.2的Tensorflow SyntaxError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!