Use cx_freeze to package pyqt4.9 GUI program based on python3.2 [graphic tutorial]

Source: Internet
Author: User

Original post address

Http://www.newsmth.net/nForum! Article/Python/95829

Completely solve the problem of using cx_Freeze-4.3 on 32-bit Windows 7

PackagePython3.2 + pyqt4.9 is an EXE file.After,

Unable to run in Chinese path, and cannot package file name


YesChinese problems


My environment is:

32-bit Windows 7 + python3.2 + pyqt4.9

Cx_Freeze-4.3

 
Download the supporting software as follows:


Cx_Freeze-4.3.win32-py3.2.zip attachment (674.6kb)


-----------------------------------------------

Step 1. Install cxfreeze.

 

Step 2. Modify the file after installation.

 

 

 

Step 3. Install cx_freeze and check whether the installation is correct.

 

 

 

 

 

Step 4. Package the file into an EXE file.

 

 

 

 

 

 

 

Step 5. Check whether the Chinese file name and Chinese path are running normally after packaging.

 

 

 

 

Tutorial ended

The key to solving the problem lies in the setup. py file. The setup. py file from the Internet may have been written in python2 at the beginning. Of course, it is troublesome to support Chinese characters. So I added the following two statements at the beginning of this file, and thenSaving the setup. py file as UTF-8 encoding solves all Chinese problems.

The added statement is:

#! /Usr/bin/ENV Python
# Coding = UTF-8

I have been searching for a long time on the Internet and have not found any solution. I am very happy to solve this problem through my own efforts. The reason why I sent this tutorial is to leave it to friends who are troubled by this problem, so that they can avoid detours and save more time on programming.
The most difficult problem is the simplest solution.

My note: as the original author said, the core is to set the encoding. However, the author uses UTF-8 in windows, which is quite strange. In fact, I do not know the encoding of the file. In short, this is feasible. Do not forget to open setup. py in notepad and save it as UTF-8 (win gbk by default)

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.