首页 > 其他分享 >Protobu生成文件报错

Protobu生成文件报错

时间:2022-09-26 11:44:48浏览次数:51  
标签:bin profile protoc bash 生成 报错 user go Protobu

报错信息:

user@C02FP58GML7H pbfile % protoc --go_out=./ ./user.proto
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go_out: protoc-gen-go: Plugin failed with status code 1.

解决办法

  1. 找到protoc-gen-go 文件,复制文件到/usr/local/bin/目录下,该文件通过go get安装时会默认安装在$GOPATH/go/bin目录下,博主本人的安装路径/Users/user/go/bin
    执行复制命令:cp protoc-gen-go /usr/local/bin/
  2. 修改环境变量配置:vim ~/.bash_profile
    添加:export GOPATH=$HOME/go PATH=$PATH:$GOPATH/bin
    刷新环境变量:source ~/.bash_profile

结果示例:

user@C02FP58GML7H bin % vim ~/.bash_profile
user@C02FP58GML7H bin % source ~/.bash_profile
/Users/user/.bash_profile:source:3: no such file or directory: /usr/local/bin/virtualenvwrapper.sh

标签:bin,profile,protoc,bash,生成,报错,user,go,Protobu
From: https://www.cnblogs.com/wylshkjj/p/16730349.html

相关文章