Tensorflow Protobuf不兼容
由于原始不兼容,我无法使张量变量变得可行。感谢是否有人建议如何修复它。
以下是错误:
$ python a.py
Traceback (most recent call last):
File "a.py", line 20, in <module>
a = tf.Variable(tf.zeros(2))
File "/opt/miniconda3/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/opt/miniconda3/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 177, in _variable_handle_from_shape_and_dtype
handle_data.shape_and_type.append(
AttributeError: 'google.protobuf.pyext._message.RepeatedCompositeCo' object has no attribute 'append'
(base) kanduru@SJC-L-00060215:/mnt/c/Users/kanduru/Documents/Courses/MIT/skunk/Auto-Surprise$
代码是
import tensorflow as tf
a = tf.Variable(tf.zeros(2))
$ pip list | grep tensorflow
tensorflow 2.7.0
tensorflow-estimator 2.7.0
$ pip list | grep protobuf
protobuf 4.21.1
I could not get the tensorflow Variables to work because of protobuf incompatibility. Appreciate if someone can suggest how to fix it.
The following is the error:
$ python a.py
Traceback (most recent call last):
File "a.py", line 20, in <module>
a = tf.Variable(tf.zeros(2))
File "/opt/miniconda3/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/opt/miniconda3/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 177, in _variable_handle_from_shape_and_dtype
handle_data.shape_and_type.append(
AttributeError: 'google.protobuf.pyext._message.RepeatedCompositeCo' object has no attribute 'append'
(base) kanduru@SJC-L-00060215:/mnt/c/Users/kanduru/Documents/Courses/MIT/skunk/Auto-Surprise$
and the code is
import tensorflow as tf
a = tf.Variable(tf.zeros(2))
$ pip list | grep tensorflow
tensorflow 2.7.0
tensorflow-estimator 2.7.0
$ pip list | grep protobuf
protobuf 4.21.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
tensorflow
安装或Tensorflow
版本与现有库的兼容性可能存在问题。Protobuf
在安装TensorFlow
时,将其与特定版本与Tensorflow版本兼容。您可以使用以下代码将
Tensorflow
版本升级到最新版本,请再次尝试:请查看此 tensorflow安装指南有关更多详细信息。
让我们知道问题是否仍然存在。谢谢。
There could be an issue with the

TensorFlow
installation orTensorFlow
version compatibility with existing libraries.protobuf
gets installed itself with its specific version compatible to Tensorflow version while installingTensorFlow
.Could you please try again by upgrading the
TensorFlow
version to the latest version using the code below:Please have a look at this Tensorflow install guide for more details.
Let us know if the issue still persists. Thank you.