Python third party libraries packaged --PyInstaller

(1 Introduction

  PyInstaller third-party package is Python library that can be implemented to convert any extension of .py Python source code to Windows, Linux, Mac OS X below executable file. For Windows is concerned, PyInstaller Python source code can be turned into executable .exe file, so that you can run the program directly, without the need to install the Python interpreter does not need to be computer-related environmental restrictions.

  Official website: http://www.pyinstaller.org/

  Pip install third-party libraries need to use tools, run the installation command (not IDLE) in the command line. Note: You need to Python Scripts directory under the directory to environment variable .

  Use the command PIP install pyinstaller install third-party libraries, you will be prompted successfully installed after installation, inform the installation was successful.

(2) Description

  PyInstaller After the installation is complete, run the file will be generated in the directory Python amount Scripts directory. At this time, using the command line Pyinstaller -F <.py file address> Command program to be packaged.

  For example: running under Windows

C:\Users\Administrator>PyInstaller -F C:\Users\Administrator\Desktop\hello_world.py

  Will produce a folder after PyInstaller run is complete, in the folder will have the .exe file.

(3) commonly used options

Options description
-h View Help
--clean Clean up temporary files created during packaging
-D, - onedir

Create a file designated folder that contains the executable file, there is a default value

(Some version is dist, some version __pycache__, etc.)

-F,--onefile Only generates a separate package file in the folder, the document can perform the same function .py complete source code files
-i <filename chart .ico> Specify the package file to use icon (.ico)

 

  Packing the program can be run on the same system, without installing PyInstaller, you do not need Python.

Guess you like

Origin www.cnblogs.com/diantong/p/12560059.html