找不到 `protoc` 命令

m.m*_*era 9 python object-detection protoc tensorflow

当我运行这个:

protoc --python_out=. .\object_detection\protos\anchor_generator.proto
Run Code Online (Sandbox Code Playgroud)

在命令行上的 tensorflow 对象检测文件上,我得到:

'protoc' is not recognized as an internal or external command, operable program or batch file.
Run Code Online (Sandbox Code Playgroud)

我按照protoc object_detection/protos/*.proto: No such file or directory 中的所有说明进行操作,但它们从来没有为我工作过

除了我进行的搜索之外,我还尝试了以下命令:

py-3.6 -m pip install protobuf
Run Code Online (Sandbox Code Playgroud)

它对我有用。

我再次输入命令

python_out=. .\object_detection\protos\anchor_generator.proto 
Run Code Online (Sandbox Code Playgroud)

但它仍然失败,这是:

C:\Users\laptop market\Downloads\bin\protoc object_detection/protos/*.proto --py_out=.
Run Code Online (Sandbox Code Playgroud)

也失败了。

小智 9

您需要将protoc.exe位于 zip 文件中的文件保存到 C:\Users\Satyarth\AppData\Local\Programs\Python\Python36\Scripts.

用您的用户名替换路径中的“Satyarth”。

如果还是不行,把上面的路径放到环境变量中。


小智 5

我在 Windows 10 上解决这个问题的方法是

  1. 复制protoc文件https://github.com/protocolbuffers/protobuf/releases/download/v3.12.4/protoc-3.12.4-win64.zip从链接https://github.com/protocolbuffers/protobuf/releases
  2. 解压缩 zip 文件的内容。
  3. bin目录包含protoc.exe
  4. 更新环境变量以指向包含 protoc.exe 的 bin 目录
  5. 重新打开cmd,因为环境变量只在新的命令窗口生效
  6. 运行protoc object_detection/protos/*.proto --python_out=。


Der*_*how 0

根据您的平台,您可能必须在本地安装 protobuf。请参阅文档以获取更详细的说明。