c - 在 Windows 上从 Python 运行 C 程序
问题描述
我试图按照本教程在 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;
}
解决方案
推荐阅读
- python - Matplotlib 以 POSIX 时间显示日期
- sql - Oracle 透视 SQL
- python - 与 IGNORECASE 意外的正则表达式匹配
- python-3.x - 将 INSERT INTO 与提供的文本字符串和从另一个表中选择 * 一起使用
- javascript - 我需要在asp.net web api中从服务器端生成一个弹出窗口
- azure - Azure Event Hub / Topic / Queue Best Approach
- powerbi - 测量以逐行计算现有列中的值之间的差异
- jenkins - Running YAML code in Jenkins Pipeline for Environment Provisioning
- mysql - 获取特定范围内的平均值
- c++ - Qt Creator 无法在 Mac 上开始调试