【发布时间】:2026-01-21 16:40:01
【问题描述】:
我已经在 python 2.7 中使用 pip 安装了 tensorflow。
当我尝试在 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
>>>
我目前正在运行:
- ubuntu 16.04
- ros1 运动学
- python 2.7
- keras 2.6
- 张量流 1.14
- protobuf 3.18.0
【问题讨论】:
-
你安装了什么版本的protobuf?
-
使用点子秀,3.18.0
标签: python-2.7 tensorflow ros