我的python软件包包含很多由python-protobuf(Arch Linux上的python2-protobuf-2.5.0)编译的文件,我在Ubuntu服务器12.04.3上安装了软件包蟒蛇-protobuf的-2.4.1),试运行代码,并击中了以下错误:如何处理python protobuf的不同版本
from google.protobuf.internal import enum_type_wrapper
ImportError: cannot import name enum_type_wrapper
我想这是因为我的包中的protobuf的模块通过的protobuf-2.5.0编译和他们不这样做与protobuf-2.4.1一起工作。
我不知道我的代码可能运行的环境,protobuf的版本可能会有所不同。如何使我的包与protobuf 2.4和2.5一起工作? (可能的方法:在我的包中包含两组不同的protobuf库(一个由2.4.1编译,另一个由2.5.0编译),在运行时获取google.protobuf版本并选择要导入的protobuf库。是否有可能?