如何解决在 Windows 上从 Python 运行 C 程序
我试图按照 this tutorial 在 python 中执行 C 程序。该教程提到它仅适用于 linux。让它在 Windows 10 上运行的正确方法是什么?
# Python 3 program to demonstrate subprocess
# module
import subprocess
import os
def excuteC():
# store the return code of the c program(return 0)
# and display the output
s = subprocess.check_call("gcc HelloWorld.c -o out1;./out1",shell = True)
print(",return code",s)
#include<stdio.h>
int main()
{
printf("Hello World from C");
// returning with any other non zero value
// would result in an exception
// when called from python
return 0;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。