使用linux的庫函數(shù):execvp()來調(diào)用python腳本時(shí),會(huì)報(bào)這個(gè)錯(cuò)。
解決方法:需要執(zhí)行的python文件使用絕對(duì)路徑來指定,就像這樣:
char *args[] = {"/usr/bin/python3", "/home/zgy/test.py", NULL};
int res = execvp(args[0], args);
if (res == -1){
perror("Error:");
}