Python Packs the Py script to generate the EXE executable file __python

Source: Internet
Author: User

Python Environment 2.7.4

The final effect is as follows

Using the Pyinstaller

It takes two steps to pack an EXE here

First step

Command line direct pip install Pyinstaller in a Python environment

Second Step

When the download is complete,

Command line

Pyinstaller-f file name

You can generate EXE files, files in general c/user/your username/dist/under

If you want to modify the icon, just

pyinstaller-f filename-I icon name, example below


Note that here-F must be capitalized, I must be lowercase

In addition, the command-line encoding is GBK, and the Py script will be entered in Chinese, which is usually set to Utf-8, i.e.

#coding =utf-8

Therefore, the output of the command line will be garbled, there are two solutions, one is to change the command line to UTF-8 format

One is to add after the output

. Decode ('utf-8 '). Encode (' GBK ')
Such as:
"Delete Complete". Decode ('utf-8 '). Encode (' GBK ')
(sql_name_alter+ "Add new column"+column_name+"Success"). Decode (' Utf-8 '). Encode (' GBK ')

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.