Use Pyinstaller to package python files as exe files

Source: Internet
Author: User

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

Official Document: https://pyinstaller.readthedocs.io/en/stable/

Pyinstaller supports Python 2.7 and Python version 3.3+, and supports Windows (xp+), Mac OS X (10.7+), and Linux, but only the corresponding program is compiled on the corresponding system.

1, Pyinstaller Installation

Install directly in cmd (Command prompt)

1 Install Pyinstaller

Wait for Pip to automatically download Pyinstaller, Pefile, Pypiwin32, the future a total of four files and automatically installed, after the installation is completed input

1 Pyinstaller

The output Pyinstaller is used as follows:

1usage:pyinstaller-script.py [-h] [-v] [-d] [-f] [--specpath DIR] [-N NAME]2[-P DIR] [--hidden-Import ModuleName]3[--additional-hooks-dirHookspath]4[--runtime-Hook Runtime_hooks]5[--exclude-module excludes] [--key Key] [-d] [-S]6[--NOUPX] [-c] [-W]7[-I <file.ico or file.exe,id or file.icns>]8[--version-fileFILE] [-M <file or xml>]9[-R RESOURCE] [--uac-admin] [--uac-UIAccess]Ten[--win-private-Assemblies] One[--win-no-prefer-redirects] A[--osx-bundle-identifier Bundle_identifier] -[--distpath DIR] [--workpath Workpath] [-y] -[--upx-dirUpx_dir] [-a] [--Clean ] the[--log-level level] [--UPX UPX] - ScriptName [scriptname ...] -Pyinstaller-script.py:error:the following arguments is Required:scriptname

2, Pyinstaller use

Enter the command directly in CMD:

1 pyinstaller-f-w E:\Programer\Python\scraping\demo3.py

After a series of information and warning output is completed, it will indicate where the generated exe file is stored.

Locate the Directory C:\Windows\system32\dist\ folder (possibly also in the C:\Windows\SysWOW64\dist\ file, estimated to be related to Python 32bit/64bit) to run the generated EXE file

[Options]

-F Generate an EXE single file

-D Generate a folder (default option)

Use Pyinstaller to package python files as 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.