下载地址:
http://code.google.com/p/protobuf/downloads/list
安装命令
tar -xzf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
./configure --prefix=$INSTALL_DIR
写proto文件
package lm;
message Person
{
required int32 id = 1;
required string str = 2;
optional int32 opt = 3;
}
保存为 testp.testpb.proto
编译指令
protoc -I=/home/workspace/testprob --python_out=/home/workspace/testprob /home/workspace/testprob/testp.testpb.proto
google
https://developers.google.com/protocol-buffers/docs/pythontutorial
报错
package directory 'google/protobuf/compiler' does not exist
解决
https://
http://code.google.com/p/protobuf/downloads/list
安装命令
tar -xzf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
./configure --prefix=$INSTALL_DIR
make
make check
make install
然后进入python目录,
python setup.py install --prefix=$INSTALL_DIR
写proto文件
package lm;
message Person
{
required int32 id = 1;
required string str = 2;
optional int32 opt = 3;
}
保存为 testp.testpb.proto
编译指令
protoc -I=/home/workspace/testprob --python_out=/home/workspace/testprob /home/workspace/testprob/testp.testpb.proto
https://developers.google.com/protocol-buffers/docs/pythontutorial
报错
package directory 'google/protobuf/compiler' does not exist
解决
https://