I want to downgrade my protobuf version in order t

2019-04-13 09:05发布

问题:

xy@xy-desktop:/usr/bin$ sudo apt-get install libprotobuf-dev protobuf-compiler

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libprotobuf-dev is already the newest version (2.6.1-1.3).
protobuf-compiler is already the newest version (2.6.1-1.3).
0 upgraded, 0 newly installed, 0 to remove and 361 not upgraded.

xy@xy-desktop:/usr/bin$ protoc --version
libprotoc 3.0.2

回答1:

It seems you have installed protobuf 3.0.2 from some external source whose binary is probably in /usr/local/bin, while the protobuf 2.6.1 installed from repo has its binary in /usr/bin. Try this:

export PATH=/usr/bin:$PATH
protoc --version

Whenever you want to go back to using protobuf 3.0.2, just ensure that /usr/local/bin is at the left side in PATH environment variable.

Please note that this may also have similar effect on other binaries which are present in both /usr/bin and /usr/local/bin (for the current terminal session).

A permanent solution to this would entail uninstalling protobuf 3.0.2, by running

sudo make uninstall

in the source folder of protobuf 3.0.2.