Convert a python. py file to an executable file. exe

Source: Internet
Author: User

Python is a powerful tool, but the. py file that we generate needs to be converted to an. exe file in the absence of a python environment, and I'm using Pyinstaller

1, installation Pyinstaller:

Pip Install Pyinstaller

2. Write the PY program in advance.

3.

cmd into the extracted directory, execute the following command:

Python pyinstaller.py [opts] yourprogram.py

The main options are:

-F,-onefile packaged as an EXE file

-D,-onedir creates a directory that contains EXE files but relies on many files (default option)

-C,-console,-nowindowed use console, no interface (default)

-W,-windowed,-noconsole using Windows, no console

4, I follow the method of 3 to perform the display error, the hint can not find pyinstaller.py, I found the Pyinstaller.exe file under the E:\ProgramData\Anaconda3\Scripts folder (not installed Anaconda3 's friends may be found in the Python installation directory of Scripts ). My approach is to:

Enter cmd under the E:\ProgramData\Anaconda3\Scripts folder, execute command: Pyinstaller.exe [opts] yourprogram.py

Example:pyinstaller.exe-f E:\Pythonchengxu\test.py

The generated. exe file will be found in E:\ProgramData\Anaconda3\Scripts\dist after success

Convert a python. py file to an executable file. exe

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.