인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

zaphong님의 프로필 이미지
zaphong

작성한 질문수

파이썬 무료 강의 (활용편6) - 이미지 처리 (OpenCV)

환경설정 및 기본 코드 정리

mediapipe 임포트가 안되요...

작성

·

2.4K

0

- mediapipe 그래도 따라해서 설치하고 import mediapipe as mp 로 시험해봤는데 에러만 떠요
 
TypeError                                 Traceback (most recent call last)
C:\Users\WORK_M~1\AppData\Local\Temp/ipykernel_17564/3811128499.py in <module>
----> 1 import mediapipe

~\AppData\Roaming\Python\Python39\site-packages\mediapipe\__init__.py in <module>
     15 
     16 from mediapipe.python import *
---> 17 import mediapipe.python.solutions as solutions

~\AppData\Roaming\Python\Python39\site-packages\mediapipe\python\solutions\__init__.py in <module>
     15 """MediaPipe Solutions Python API."""
     16 
---> 17 import mediapipe.python.solutions.drawing_styles
     18 import mediapipe.python.solutions.drawing_utils
     19 import mediapipe.python.solutions.face_detection

~\AppData\Roaming\Python\Python39\site-packages\mediapipe\python\solutions\drawing_styles.py in <module>
     18 from mediapipe.python.solutions import face_mesh_connections
     19 from mediapipe.python.solutions import hands_connections
---> 20 from mediapipe.python.solutions.drawing_utils import DrawingSpec
     21 from mediapipe.python.solutions.hands import HandLandmark
     22 from mediapipe.python.solutions.pose import PoseLandmark

~\AppData\Roaming\Python\Python39\site-packages\mediapipe\python\solutions\drawing_utils.py in <module>
     23 import numpy as np
     24 
---> 25 from mediapipe.framework.formats import detection_pb2
     26 from mediapipe.framework.formats import location_data_pb2
     27 from mediapipe.framework.formats import landmark_pb2

~\AppData\Roaming\Python\Python39\site-packages\mediapipe\framework\formats\detection_pb2.py in <module>
     14 
     15 
---> 16 from mediapipe.framework.formats import location_data_pb2 as mediapipe_dot_framework_dot_formats_dot_location__data__pb2
     17 
     18 

~\AppData\Roaming\Python\Python39\site-packages\mediapipe\framework\formats\location_data_pb2.py in <module>
     14 
     15 
---> 16 from mediapipe.framework.formats.annotation import rasterization_pb2 as mediapipe_dot_framework_dot_formats_dot_annotation_dot_rasterization__pb2
     17 
     18 

~\AppData\Roaming\Python\Python39\site-packages\mediapipe\framework\formats\annotation\rasterization_pb2.py in <module>
     34   containing_type=None,
     35   fields=[
---> 36     _descriptor.FieldDescriptor(
     37       name='y', full_name='mediapipe.Rasterization.Interval.y', index=0,
     38       number=1, type=5, cpp_type=1, label=2,

~\anaconda3\lib\site-packages\google\protobuf\descriptor.py in __new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key)
    558                 has_default_value=True, containing_oneof=None, json_name=None,
    559                 file=None, create_key=None):  # pylint: disable=redefined-builtin
--> 560       _message.Message._CheckCalledFromGeneratedFile()
    561       if is_extension:
    562         return _message.default_pool.FindExtensionByName(full_name)

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_IMPLEMENTATION=python (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

 

답변 1

0

zaphong님의 프로필 이미지
zaphong
질문자

mediapipe 사용하려면 Jupyter Notebook 내 Python 버전 3.7로 낮춰야 합니다.

zaphong님의 프로필 이미지
zaphong

작성한 질문수

질문하기