Windows uses Pyinstaller to package Python3 programs into executable exe files

Source: Internet
Author: User

Pip

Pip is a tool for installing Python packages, typically in the scripts folder in the Python installation directory. If there is a PIP on the computer, open the cmd window, enter the PIP directory, or add this directory to the environment variable, enter

PIP List

You can see the Python packages that have been installed

If not on the computer, you can download a link to the Internet Https://pypi.python.org/pypi/pip


After the download is complete, unzip to a folder, use the CMD console to enter the Extract directory, enter:

Python setup.py Install

Wait for the installation to complete

Pyinstaller

Pyinstaller is a module used to package the program, need to download the official website, download link http://www.pyinstaller.org/downloads.html


The version of Python supported by the current version, and how to install it, are available on the official website.

Download it, unzip it, use CMD to enter the Unzip directory, enter

Pip Install Pyinstaller

In this step my installation process has been a lot of errors, the basic is the lack of modules caused. If the hint is missing distribute, download the website, https://pypi.python.org/pypi/distribute, install with PIP

Pip Install Distribute

If Setuptools, Pywin32 is missing, the installation is also downloaded.

If you still have an error, try entering this

PIP3 Install Pyinstaller

Packaging (Note: When running the command line, be sure to run in the code directory, or you will not be able to open the file after packaging)

Place the program you want to package (that is, the. py file and the referenced resource file) in a folder, enter the directory with CMD, enter

Pyinstaller-f-W XXX. PY

If an error occurs, or if the file is not opened after packing, the first check is in the code directory, and the second command is changed to:

Pyinstaller--hidden-import=queue-w-F $FileName $

Wait for the package to complete, will generate a build folder and a dist folder, exe executable file in the Dist folder, if the program refers to resources, you have to put the resource file in this exe correct relative directory.

If the package is wrong, you can refer to the WarnXXX.txt file in the build folder, which records some warning messages for informational purposes only and does not necessarily identify errors inside.

Windows uses Pyinstaller to package Python3 programs into executable exe files

Related Article

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.