Custom Python import module failed (protobuf)

sankarramanv at sankarramanv at
Fri Apr 20 06:24:46 EDT 2018


I need to use the google protobuf for my task.

1. Yum install protobuf worked for default python 2.7.5 in my VM. But I need to test with Python 2.7.14.

I installed protobuf using yum on "/usr/lib64/python2.7/site-packages"

I added the above path to PYTHONPATH and its not recognizing when run as ordinary user.

But when run through sudo cmd its working. But due to lower Python 2.7.5, it fails.

I ran like:

sudo python

2. My main requirement is to test things from Python 2.7.14.
Also I installed python 2.7.14 in /usr/local/bin.

When I try to use /usr/local/bin/python it fails to import google protobuf installed through yum.

sudo PYTHONPATH=/usr/lib64/python2.7/site-packages /usr/local/bin/python

Re-installing protobuf also does not help.

3. For this purpose, When I don't use yum and build protobuf from src code, added /usr/local/include to PYTHONPATH (where google.protobuf present), it still import fails.

"from google.protobuf import *" or import google.protobuf fails.

Appreciate inputs.


More information about the Python-list mailing list