Qt打开winpython并输入命令

2024-09-29 02:29:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我在windows上,我在Qt上制作了一个程序,我需要打开winpython命令提示符并输入一些命令来启动一个带有参数python program.py image1 image2的py文件

我的问题是我可以打开winpython命令提示符,但我的所有参数都在标题中

{
QString softwarePath = "program.py";
QString pythonInterpreterPath = "d:\\Application\\WPy64-3741\\WinPython Command Prompt.exe";
QString command("python");
QString fileSave = filePath;
fileSave = fileSave.replace(fileSave.length()-4, 0, "-analyse");
QStringList params = QStringList() << "/C" << command << softwarePath << filePath << fileSave;
QProcess *process = new QProcess();
process->start(pythonInterpreterPath, params);
process->waitForFinished();
process->close();
}

params in command prompt title

谢谢你的帮助


Tags: py参数paramsprogramprocesscommand命令提示符winpython