我想从c语言运行一个python脚本。我试着成功编译它,但是它给出了一个错误“python不能被识别为内部或外部命令、可操作程序或批处理文件”。在
#include <iostream>
using namespace std;
// main() is where program execution begins.
int main()
{
std::string filename = "hi.py";
std::string command = "python ";
command += filename;
FILE* in = popen(command.c_str(), "r");
pclose(in);
return 0;
}
您希望使用python可执行文件的完整路径,例如:
相关问题 更多 >
编程相关推荐