protoc cannot find files in windows 7

2019-08-07 10:33发布

问题:

I'm trying to run the Object Detection high level API I found on Tensorflow github. One of the steps is to compile the module like this:

protoc object_detection\protos\*.proto --python_out=.

When I do that I get this message:

object_detection\protos\*.proto: No such file or directory

Any idea? I'm running Windows 7

EDIT: if I run:

protoc --python_out=. *.proto

from the right folder, I get:

*.proto: No such file or directory

回答1:

Windows 7 cmd doesn't accept wildcard (*). This way, the *.proto doesn't match, because you don't have a file named *.proto.

If you want to apply protoc --python_out=. filepath, you have to use a for loop or issue the protoc manually for all files individually.



回答2:

The Symbol ' * ' is the problem. Sometimes windows does not recognize it. So the best way to do it is by converting the proto files one by one.

Best way to do it

C:/Users/kc/Desktop/bin/protoc object_detection/protos/(file name in proto folder).proto --python_out=.

Since i have extracted my files to the desktop the above code is applicable to me.

The above code will only work when you have extracted your model file and (proto 3.4) bin file to the desktop.



回答3:

Try reviewing if your pwd is correct, perhaps python.exe is running on a different folder, where the subfolder object_detection doesn't exist, can you print the os.getcwd() and see if your program think it is where it should be, maybe you can also use os.chdir() to "enter" the folder or maybe you can simply use full path names.



回答4:

This one worked for me on Windows 10 in cmd:

C:\your\path\tensorflow\models\research>“C:\your\path\protoc-3.4.0-win32\bin\protoc.exe” object_detection/protos/*.proto --python_out=.

If it executes without any error or message, then it worked.

I've used protoc version 3.4.0 for this process.

Referenced from this Stackoverflow Question.