Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
534 views
in Technique[技术] by (71.8m points)

python - 如何使Python脚本独立可执行文件在没有任何依赖的情况下运行? [关闭](How to make a Python script standalone executable to run without ANY dependency? [closed])

I'm building a Python application and don't want to force my clients to install Python and modules.

(我正在构建一个Python应用程序,并且不想强迫我的客户安装Python和模块。)

I also want to make my application closed-source.

(我也想将我的应用程序设为开源。)

So, is there a way to compile Python scripts to standalone executables?

(那么,有没有办法将Python脚本编译为独立的可执行文件?)

  ask by Jeff translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use PyInstaller to package Python programs as standalone executables.

(您可以使用PyInstaller将Python程序打包为独立的可执行文件。)

It works on Windows, Linux, and Mac.

(它适用于Windows,Linux和Mac。)

PyInstaller Quickstart (PyInstaller快速入门)

Install PyInstaller from PyPI:

(从PyPI安装PyInstaller:)

 pip install pyinstaller 

Go to your program's directory and run:

(转到程序的目录并运行:)

 pyinstaller yourprogram.py 

This will generate the bundle in a subdirectory called dist .

(这将在名为dist的子目录中生成捆绑包。)

For a more detailed walkthrough, see the manual .

(有关更详细的演练,请参见手册 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...