douhongxie5436 2019-04-22 02:15 采纳率: 100%
浏览 38
已采纳

如何从该站点下载协议缓冲区v3?

I'm following this tutorial to install Protocol Buffers v3:

https://grpc.io/docs/quickstart/go.html#install-grpc

It says "The simplest way to do this is to download pre-compiled binaries for your platform", what is "platform" here? Operating System or Programming Languages? Im confused at this step, because I dont understand what its saying exactly.

I even tried to follow the link but there is no Protobuf installation for "GoLang" at all, I can see java, python, linux, win, osx etc and I dont know which one to choose and this added to my frustration:

http://prntscr.com/nf2qye

Even if I download the file somehow then how and exactly where do I unzip in Linux?

Even if I unzip it somewhere then what will be the code to write in the bash_profile to update the environment variable PATH to include the path to the protoc binary file as mentioned in the tutorial?

Please help, thanks.

  • 写回答

1条回答 默认 最新

  • dqgxazo4483 2019-04-22 03:29
    关注

    that binary is OS dependent and contains the protoc compiler to compile the protobuffs.

    protoc-3.6.0-linux-x86_64.zip

    Note: 3.6.0 is not the latest version

    you will find all the binary here

    download the zip, unzip and copy that protoc bin to

    /usr/local/bin
    

    run below commands for Linux:

    mkdir -p /tmp/protoc && \
            wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
            unzip protoc-3.6.0-linux-x86_64.zip -d protoc3 && \
            cp protoc3/bin/* /usr/local/bin/ && \
            cp -R protoc3/include/* /usr/local/include && \
            chmod +x /usr/local/bin/protoc && \
            rm -rf /tmp/protoc 
    

    just type protoc in the terminal, it should work.

    For go lang code generation, you have to download code generator separately. i,e;

    protoc-gen-go.

    install go and set the GOPATH.

    then, run below command :

    go get github.com/golang/protobuf/protoc-gen-go
    

    After that, you could use go code generator plugin to generate the code like below:

    protoc -I . hello.proto --go_out=plugins=grpc:out
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?