
一、错误树莓派使用mediapipe时出现的错误import mediapipe Traceback (most recent call last): File stdin, line 1, in module File /home/pi/.local/lib/python3.7/site-packages/mediapipe/__init__.py, line 17, in module import mediapipe.python.solutions as solutions File /home/pi/.local/lib/python3.7/site-packages/mediapipe/python/solutions/__init__.py, line 17, in module import mediapipe.python.solutions.drawing_styles File /home/pi/.local/lib/python3.7/site-packages/mediapipe/python/solutions/drawing_styles.py, line 20, in module from mediapipe.python.solutions.drawing_utils import DrawingSpec File /home/pi/.local/lib/python3.7/site-packages/mediapipe/python/solutions/drawing_utils.py, line 25, in module from mediapipe.framework.formats import detection_pb2 File /home/pi/.local/lib/python3.7/site-packages/mediapipe/framework/formats/detection_pb2.py, line 15, in module from mediapipe.framework.formats import location_data_pb2 as mediapipe_dot_framework_dot_formats_dot_location__data__pb2 File /home/pi/.local/lib/python3.7/site-packages/mediapipe/framework/formats/location_data_pb2.py, line 15, in module from mediapipe.framework.formats.annotation import rasterization_pb2 as mediapipe_dot_framework_dot_formats_dot_annotation_dot_rasterization__pb2 File /home/pi/.local/lib/python3.7/site-packages/mediapipe/framework/formats/annotation/rasterization_pb2.py, line 41, in module serialized_optionsNone, fileDESCRIPTOR), File /home/pi/.local/lib/python3.7/site-packages/google/protobuf/descriptor.py, line 561, in __new__ _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are: 1. Downgrade the protobuf package to 3.20.x or lower. 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATIONpython (but this will use pure-Python parsing and will be much slower). More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates根据报错信息是我们的protobuf版本过高需要降低到3.20.x版本或以下根据网络上查找的解决方法都是让安装 protobuf3.20 版本安装这个版本确实有用但是通过正常的 pip3 install protobuf3.20 是无法安装的会报错No matching distribution found for protobuf3.20意思是没有找到对应版本的protobuf二、解决方法从我资源里下载 protobuf3.20.1传到板子上去然后执行安装命令pip3 install protobuf-3.20.1-py2.py3-none-any.whl资源链接protobuf-3.20.1-py2.py3-none-any.whl执行结果并测试