argv cannot be an empty list, and must contain the program name as the first element C++調用python出錯

在C++調用python工程中

涉及到tf.app.flags無法在調用中使用

報錯argv cannot be an empty list, and must contain the program name as the first element

你可以在使用flags的腳本中

import sys
print(sys.argv)

看一下argv的情況,如上報錯應該是argv = []

這時你可以根據純python運行時,再看以下argv應該是什麼,然後手動添加,例如

import sys
sys.argv = ['/home/yas/ClionProjects/person_segmentation.py']

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章