简体   繁体   English

如何将带有 .Net 应用程序的 Python 作为一个安装可执行文件分发?

[英]How do I distribute Python with a .Net application as one installation executable?

I have a .NET application written in C#, on Visual Studio, that calls some Python scripts to run data through some Machine Learning scripts, models and processes.我在 Visual Studio 上有一个用 C# 编写的 .NET 应用程序,它调用一些 Python 脚本来通过一些机器学习脚本、模型和进程运行数据。

I have a requirement to distribute the software as a single installation package/executable onto Windows platform machines that may not have either python nor .NET runtime libraries installed.我需要将软件作为单个安装包/可执行文件分发到 Windows 平台机器上,这些机器可能没有安装 python 或 .NET 运行时库。

Distribution of either a .NET application or a Python application (to include the Python runtimes) appears to be well documented, but how do I marry the two? .NET 应用程序或 Python 应用程序(包括 Python 运行时)的分发似乎有据可查,但我如何将两者结合起来?

Note: It does not matter whether the final installation executable is produced by Python or .NET (Visual Studio) only that it is distributed as one installation package/executable.注意:最终安装可执行文件是由 Python 还是 .NET (Visual Studio) 生成的并不重要,只是它作为一个安装包/可执行文件分发。

I do not have experience with C#, but you could try to compile the python script using pyinstaller , which compiles python code to a stand-alone executable.我没有使用 C# 的经验,但您可以尝试使用pyinstaller编译 python 脚本,它将 python 代码编译为独立的可执行文件。

Then, you can try embedding this executable into your C# program, as discussed here .然后,您可以尝试嵌入该可执行文件到您的C#程序,为讨论在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM