Here is a sample Python code for PyInstaller:

# hello.py
def hello():
    print("Hello, World!")

if __name__ == '__main__':
    hello()

To create an executable file using PyInstaller, follow these steps:

  1. Install PyInstaller using pip:
pip install pyinstaller
  1. Navigate to the directory containing your Python script.

  2. Run the following command to create a standalone executable file:

pyinstaller --onefile hello.py

This will create a single executable file named hello in the dist directory.

  1. Run the executable file by navigating to the dist directory and running:
./hello

This should output "Hello, World!" to the console.

Sample python code for PyInstaller?

原文地址: http://www.cveoy.top/t/topic/f3a 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录