pyinstaller packed packing method --Pyinstaller Python

Python packaging method --Pyinstaller

 

Python version: Python3.5.2

First, install Pyinstaller

1, the installation pywin32

    • Download the installation file: find yourself with the applicable version of python and window system version that matches pywin32 , download and install 

    • Command to install using pip: pip install pywin32

2, installation Pyinstaller

    • Command to install using pip: pip install PyInstaller

Second, the use Pyinstaller

1, download and install mounted way of packaging Pyinstaller

Will need to unpack packed files in the Pyinstaller folder, open cmd window, the path is switched to the current path to open the command prompt, enter the following (the last is the file name):

    • python pyinstaller.py -F myfile.py

2, pip installed using a packaging of Pyinstaller

Cmd window open, the path is switched to the path to the file (the file just where to put all right) to open the command prompt, enter the following (the last is the file name):

    • pyinstaller -F myfile.py

Meaning 3, input parameters

  • Generating a single executable file represents -F

  • -w represent remove the console window, which is very useful when a GUI interface. But if it is a command line program, then it would put this option to delete it!

  • -p means that you need to load your own custom class path, generally less than

  • -i represents the icon of the executable file

Third, pay attention

  • Files are packaged using a third-party libraries

Be sure to find the bag before packed third-party libraries, copy the package to the next with myfile.py to the same directory, and then two or more ways to package, otherwise it will fail or even packaged packaged successful, the program will flash back.

The following presentations about the use of third-party libraries packaged way:

    • Find third-party library package, such as the use of requests, you can use to find, where to find the package, and then copy it to the same directory myfile.py

    • Copy the package file to the directory myfile.py

 

    • To change the program's icon on
      • Add a input -i tubiao.ico (relative path icon) command. Figure:

Four, exe file generation

  • If the program is not being given packaging process will generate three folders (sometimes two), in which a file named dist folder there will be a myfile.exe file, run it, if there is no problem on the packaging, you can put the exe file to go out alone with the other generated folders can be deleted.

    

Python version: Python3.5.2

First, install Pyinstaller

1, the installation pywin32

    • Download the installation file: find yourself with the applicable version of python and window system version that matches pywin32 , download and install 

    • Command to install using pip: pip install pywin32

2, installation Pyinstaller

    • Command to install using pip: pip install PyInstaller

Second, the use Pyinstaller

1, download and install mounted way of packaging Pyinstaller

Will need to unpack packed files in the Pyinstaller folder, open cmd window, the path is switched to the current path to open the command prompt, enter the following (the last is the file name):

    • python pyinstaller.py -F myfile.py

2, pip installed using a packaging of Pyinstaller

Cmd window open, the path is switched to the path to the file (the file just where to put all right) to open the command prompt, enter the following (the last is the file name):

    • pyinstaller -F myfile.py

Meaning 3, input parameters

  • Generating a single executable file represents -F

  • -w represent remove the console window, which is very useful when a GUI interface. But if it is a command line program, then it would put this option to delete it!

  • -p means that you need to load your own custom class path, generally less than

  • -i represents the icon of the executable file

Third, pay attention

  • Files are packaged using a third-party libraries

Be sure to find the bag before packed third-party libraries, copy the package to the next with myfile.py to the same directory, and then two or more ways to package, otherwise it will fail or even packaged packaged successful, the program will flash back.

The following presentations about the use of third-party libraries packaged way:

    • Find third-party library package, such as the use of requests, you can use to find, where to find the package, and then copy it to the same directory myfile.py

    • Copy the package file to the directory myfile.py

 

    • To change the program's icon on
      • Add a input -i tubiao.ico (relative path icon) command. Figure:

Four, exe file generation

  • If the program is not being given packaging process will generate three folders (sometimes two), in which a file named dist folder there will be a myfile.exe file, run it, if there is no problem on the packaging, you can put the exe file to go out alone with the other generated folders can be deleted.

    

Guess you like

Origin www.cnblogs.com/hellojack/p/11937338.html