For Pyinstaller, you can finish compiling the Python script under Windows,linux, and Mac, and generate the Exe,elf,.app file;
1. method of Use;
In Pyinstaller's official web download, generally is the source package, can be extracted directly after use:
Python pyinstaller.py test.py
A test directory is generated under the Pyinstaller directory and contains the BUID and dist two subdirectories, and the subdirectories dist the executable files;
2. If you need to compile into a single file:
Python pyinstaller.py-f test.py
To generate a single executable file
3. If you need to add a software icon:
Python pyinstaller.py-f test.py-i Test.icon
Note that the icon file must be the only line;
3. If you compile a GUI project, you can use the
Python pyinstaller.py-w test.py
Or:
Python pyinstaller.py-w test.pyw
Or:
Python pyinstaller.py-w--noconsole (under Windwos platform)
Linux default does not have pop-up windows (popup terminal);
4. Compile in a Mac environment with an app executable file.
Python pyinstaller.py test.py-w--windowed
UNIX executables and app files are included in the project directory at this time
5. Compressing the executable file
Use UPX;
UPX support WINDOWS,LINUX32/64 bit;
How to use:
Under Windows: Place the Upx.exe directly under the Pyinstaller directory;
Instructions for use under Linux:
Python pyinstaller.py test.py--upx-dir/home/test/upx/
6.mac Pyinstaller compiler is not stable, you can use Py2app to try.
Through the completion of the project, I realized that the completion of cross-platform software, compatibility is a big problem, in addition, the use of Python completed projects, temporarily compiled into executable files after the file is too large, inefficient execution;
In particular, projects that have been added to the GUI, such as projects that use QT, have been compiled to perform faster and less efficiently than executable files.
Cross-platform projects are best chosen in C or Java, because the existing compilers are very convenient.
Python Cross-platform packaging