Usage of Py2.exe

xiaoxiao2021-03-06  100

Today I found a PY2EXE tool today to convert Python's Source to the executable executor under Windows. Below is this process. I installed the version of Python2.3. After installation, you will have a PY2EXE directory in your% python23% ​​/ lib / site-packages, which is the third-party tool. There are several examples under Samples in Samples. In the principle of simply starting, I studied the example in the Simple directory. The most important thing is that you have to provide a setup.py file, this file is used to guide Py2exe compilation to generate executables. Open the file, you can read it yourself to explain that you will clear its role. The entity of the file is: from DistUtils.core Import Setupimport Py2exe

setup (# The first three parameters are not required, if at least a # 'version' is given, then a versioninfo resource is built from # them and added to the executables. version = "0.5.0", description = "py2exe sample Script ", name =" py2exe samples ",

# Targets to build windows = ["test_wx.py"], console = ["test.py"],) I use red tagged part is that you have to replace, from the words mean, it is not difficult to distinguish these two lines What role is role. I will not say much here. Then go to this directory under the console program of Windows. Get another Python.exe setup.py py2exe (of course, you can find these executables) in your Path path). At this time, this will be more than 2 subdirectories in your directory, and under DICT is in the executable program you want.

转载请注明原文地址:https://www.9cbs.com/read-105012.html

New Post(0)