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