[Python]ModuleNotFoundError: No module named ‘google’

Jaime Lin
Feb 8, 2021

--

I got started to use protobuf in Python , after installed google.protobuf compiler.

$ yum install protobuf-compiler

Problem

Traceback (most recent call last):
File "test_proto.py", line 1, in <module>
import test_simple_service_pb2
File "/app/build_py3/test_simple_service_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'

Solution

If you’re using pip3.

$ pip3 install protobuf

Pip2

$ pip install protobuf

If you like this post, you can buy me a coffee! :)

--

--

Jaime Lin
Jaime Lin

Written by Jaime Lin

From Taiwan, a beautiful island. Learning English and sharing code experience.