To package a python file using Cxfreeze

Source: Internet
Author: User

Python packaging is a really troublesome thing compared to C + + ... Small semester works is to take Python write, with or 3.6,pyinstaller not support, had to learn a cxfreeze packaging method.

First, installation

Install Cxfreeze as long as you enter PIP install Cx_freeze under CMD. Then find the location of the cxfreeze in the Python root directory.

Mine is C:\Users\24557\AppData\Local\Programs\Python\Python36\Scripts.

Second, confirm the existence of BAT file

If there is no Cxfreeze.bat file, create a TXT file yourself, enter

@echo off

C:\Users\24557\AppData\Local\Programs\Python\Python36\python.exe C:\Users\24557\AppData\Local\Programs\Python\ Python36\scripts\cxfreeze%*

The first path represents the path where Python.exe is located, and the second is the path where Cxfreeze is located.

After you modify the suffix named. bat

Third, packaging procedures

You can then use Cxfreeze to package the PY program that we want to package.

CMD down to the Cxfreeze directory, (take my above address as an example enter "CD C:\Users\24557\AppData\Local\Programs\Python\Python36\Scripts" without quotes Then return to the Cxfreeze directory.

After entering Cxfreeze you want to package the main program address--target-dir Save the address of the generated executable file

e.g Cxfreeze D:\mygame\main.py--target-dir D:\myexe

If done smoothly, the resulting EXE file is saved in the Myexe file under D.

Iv. Summary

In fact, after these steps to see, found with cxfreeze packaging also mediocre, and no how troublesome.

However, Cxfreeze packaging does not guarantee a 100% package success, a lot of small problems (may include but not limited to the file name too long file name contains Chinese, etc.) will lead to packaging failure, need attention.

To package a python file using Cxfreeze

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.