1. 程式人生 > >protoc編譯檔案時報錯:object_detection/protos/*.proto: No such file or directory

protoc編譯檔案時報錯:object_detection/protos/*.proto: No such file or directory

在學習到第五章“深度學習的目標檢測”的 “5.2.1 安裝TensorFlow Object Detection API”時需要編譯 proto檔案,因為電腦比較老舊用的Win10系統,所以嘗試從官網下載了 protoc-3.6.0-win32,解壓後將bin裡面的protoc.exe的路徑加到電腦的 環境變數的PATH中,然後執行書上給的命令 protoc object_detection/protos/*.proto --python_out=.  時 報錯:

object_detection/protos/*.proto: No such file or directory,
單個編譯的話又有好多檔案相互關聯,編譯不成功,嘗試多次後發現在models資料夾下使用  shift+右鍵 的Windows powershell中使用以下命令可以全部編譯:

Get-ChildItem object_detection/protos/*.proto |Resolve-Path -Relative | %{protoc $_ --python_out=.}     

PS:  DOS下無法使用該命令。
--------------------- 
作者:flf314 
來源:CSDN 
原文:https://blog.csdn.net/flf314/article/details/80807652 
版權宣告:本文為博主原創文章,轉載請附上博文連結!

 

注:以上方法親測可行,

總結:

1、將exe檔案新增進path環境變數中

2、在object_detection上一級資料夾中執行shell命令,這點要特別注意,不然還是會報錯,要明白這條命令裡Get-ChildItem這個詞的含義