1diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py 2index 97ac28028..8b7585d9d 100644 3--- a/python/google/protobuf/__init__.py 4+++ b/python/google/protobuf/__init__.py 5@@ -31,3 +31,9 @@ 6 # Copyright 2007 Google Inc. All Rights Reserved. 7 8 __version__ = '4.23.1' 9+ 10+if __name__ != '__main__': 11+ try: 12+ __import__('pkg_resources').declare_namespace(__name__) 13+ except ImportError: 14+ __path__ = __import__('pkgutil').extend_path(__path__, __name__) 15