[英]How to compile a C-File that calls a Python-Method on Windows 10 with Python.h and MinGW
I needed to compile a C-Programm that uses the Python.h
to call a Python-Method from an existing Python-File.我需要编译一个 C 程序,它使用
Python.h
从现有的 Python 文件调用 Python 方法。
And all that on a Windows 10 machine with MinGW
.所有这些都在带有
MinGW
的 Windows 10 机器上。
As I could not find a straight-up answer on what compile command I need, I will now post what works for me in the hope it helps others too!由于我找不到关于我需要什么编译命令的直接答案,我现在将发布对我有用的内容,希望它也能帮助其他人!
The command that worked for me is as follows:对我有用的命令如下:
gcc -o nameOfexe nameOfCFile.c -I PathToPython\include -L PathToPython\libs -lpythonXX
Explanation:解释:
Both the C-File and the Python-File are in the same Folder I run the command in. C-File 和 Python-File 都在我运行命令的同一个文件夹中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.