python learning - pyinstaller library to package python files

1. Enter the directory where the files to be packaged are located through the command line

2. Enter the following command (take the package file dpython.py as an example):

 pyinstaller dpython.py

3. After executing the command, two new folders, build and dist, will be generated in the directory where the source files are located. The build folder stores the temporary files generated during the packaging process, which can be safely deleted.

The dpython file under the dist folder contains the generated executable file dpython.exe

4. Note when using the pyinstaller library:

 (1) Spaces and English periods cannot appear in the file path

(2) The source file must be UTF-8 encoded

5. Common parameters:

 -h, --help see help

 -v, --version View pyinstaller version

 --clean clean up temporary files generated during packaging

 -O --onedir default value, generate dist directory

 -F --onefile only generate separate pack files in dist file

 -p DIR --paths DIR Add 3rd party library paths used by python files (not necessary if the 3rd party library was installed by pip and is in the python environment directory)

 -i <.ico or .exe, ID or icns> --icon<.ico or .exe, ID or icns> Specify the icon file to use when packaging the program




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325731844&siteId=291194637