如何将参数传递给已编译的 .c 代码文件?

How do I pass arguements to a compiled .py code file?

我写了一个 python 文件,我想在 C# 应用程序中使用 ,但我不想每次在新计算机上 运行 时都必须安装 python 和依赖项,所以我想将它编译为 .exe,将参数传递给它,然后得到输出。

我的代码文件看起来像这样:

import ...
import ...

def function(parameter):
 ....

如何将参数传递给函数,并接收函数的输出?

来自 Windows 上的 Python 常见问题解答:
How do I make an executable from a Python script?

See http://cx-freeze.sourceforge.net/ for a distutils extension that allows you to create console and GUI executables from Python code. py2exe, the most popular extension for building Python 2.x-based executables, does not yet support Python 3 but a version that does is in development.

另见

然后:

  • py2exe - generate single executable file