[英]Python protobuf 3.20.1 is missing Any, Empty, and other types
I just upgraded protobuf from 3.17.3 to 3.20.1 (macos, python 3.9), and my code started complaining that there is no我刚刚将 protobuf 从 3.17.3 升级到 3.20.1(macos,python 3.9),我的代码开始抱怨没有
from google.protobuf.empty_pb2 import Empty
from google.protobuf.timestamp_pb2 import Timestamp
I checked the package folder under ./venv/lib/python3.9/site-packages/google/protobuf/
and indeed there is no Empty
type there.我检查了
./venv/lib/python3.9/site-packages/google/protobuf/
下的包文件夹,确实那里没有Empty
类型。
Ok, I found Timestamp in internal/well_known_types.py
.好的,我在
internal/well_known_types.py
中找到了 Timestamp 。 Why internal?为什么是内部? It does not make sense.
它没有任何意义。
Also cannot find StringValue
and other wrapper types.也找不到
StringValue
和其他包装类型。
Is it a known bug, or I'm missing something?这是一个已知的错误,还是我错过了什么? How does someone construct
Empty
or StringValue
objects now?现在有人如何构造
Empty
或StringValue
对象?
OK, I found out my problem.好的,我发现了我的问题。 Everything worked in the first place, but IDE had been complaining about missing types until I installed the
types-protobuf
package.首先一切正常,但 IDE 一直在抱怨缺少类型,直到我安装了
types-protobuf
包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.