Pyinstaller installation Configuration Method detailed

Source: Internet
Author: User

Pyinstaller is a tool used to package Pyhon program into an EXE file, Pyinstaller is not a python package, just download the Pyinstaller file and put it anywhere you want, That is to say, Pyinstaller is the equivalent of independent to pack Python tools, this is a tool is not a library, nor a package ...
1. Download and install pyinstaller, download URL: http://www.pyinstaller.org/to download, Then extract to any directory. (Note: If you move this folder before pyinstaller2.0, you'll need to change some configuration, or Pyinstaller will not be able to use it because of your move.) This is related to the configuration environment behind. There is no limit to the pyinstaller2.0 version.
2. Compile configuration environment (to extract to F: Disk for example)
①, pyinstaller-2.0 Method:
Open the CMD CD into the unpacked directory under the Sorce, that is: CD F:pyinstaller-2.0source
Run python./waf Configure Build Install
* (You may need to install Pywin32. Download and install it, rerun the command)

②, pyinstaller-1.5
Open cmd CD into Pyinstaller decompression directory, CD f:pyinstaller-1.5
Run Python configure.py
* (You may need to install Pywin32. Download and install it, rerun the command)
The resulting prompts are saved in the Config.dat file. Where the Config.dat file is stored in the root directory of the Pyinstaller.
3. Write your own PY program package EXE
①, pyinstaller-2.0 Method:
Copy the py file (helloworld.py) you wrote to the Pyinstaller extract directory,
Open the CMD CD into the unpacked directory, which is: CD f:pyinstaller-2.0
Run command python pyinstaller.py [opts] yourprogram.py
This is where you run: Python pyinstaller.py [opts] helloworld.py
In the directory will generate a HelloWorld folder, which holds Helloworld.spec files, two folders (Dist,buildi), can run EXE is placed under/dist/yourprogram

②, pyinstaller-1.5
Copy the py file (helloworld.py) you wrote to the Pyinstaller extract directory,
Open the CMD CD into the unpacked directory, which is: CD f:pyinstaller-1.5
The difference between pyinstaller-1.5 and pyinstaller-2.0 came.
In pyinstaller-1.5 you first need to generate spec files, and then through the spec file in the build EXE file, and pyinstaller-2.0 in the execution of the command (see above) will be at the same time EXE and spec files are generated
So in pyinstaller-1.5 you have to be Mr. Spec file:
Python makespec.py [opts] yourprogram.py
Run command: Python makespec.py [opts] helloworld.py
The HelloWorld folder that is generated in this directory now has a Helloworld.spec file under the folder, and the file is copied to the directory (f:pyinstaller-1.5)
Run command: Python build.py helloworld.spec
4. You will find that in accordance with the above method in addition to the/yourprogram/dist/yourprogram EXE file, there are many DLL files, and then you will start to complain about the author I pit Dad ....
Haha, if you find out so, explain that you have finished using the most basic pyinstaller packaging, about how Pyinstaller please look down:
Whether it's pyinstaller-1.5 or pyinstaller-2.0, you want to package it into a file, or modify the file's icon, and so on, which is related to when you run the command, remember what the order is?
Pyinstaller-2.0 is:
Python pyinstaller.py [opts] yourprogram.py
pyinstaller-1.5 is:
Python makespec.py [opts] yourprogram.py
Those that are packaged into a file, or modify the file's icon, are related to this [opts].
Here are some examples (Sir a look at the pyinstaller-2.0 as an example, 1.5 general):
①, packaged into a file:
Python pyinstaller.py–onefile yourprogram.py
②, modify the exe icon (D:babywandhsrcfaviconw.ico for the icon's storage path):
Python Pyinstaller.py–onefile–icon=d:babywandhsrcfaviconw.ico yourprogram.py
[opts] Some instructions (specific can see Pyinstaller official website Http://www.pyinstaller.org/expor ... talling-pyinstaller):

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.