pyinstaller packages Python scripts into exe software so that they can be run on machines without a Python environment
# #The latest version is pyinstaller 3.1.1. Supports python2.7 and python3.3. Can run under Windows, Mac and Linux operating systems. (Recommended learning: Python video tutorial)
But it is not cross-compiled, which means that the exe generated by PyInstaller under Windows can only run under Windows, and under Linux The ones generated under can only run under Linux.Installation of pyinstaller under windows
Use the command pip install pyinstaller. Under windows, pyinstaller requires the support of PyWin32. When PyWin32 is not found when using pip to install pyinstaller, pypiwin32 will be installed automaticallySuccessfully installed pyinstaller-3.1.1 pypiwin32-219 appears, which means the installation is successfulUse
Locate the folder where pyinstaller.exe is located (usually under the "scripts" folder under python) (warm reminder: Press the tab key on cmd to complete the function)Then Add the address of the file you want to convert (there is a space between the two)
If -F is added after pyinstaller.exe, it will be packaged into an exe file (the file will be larger), if not added There will be a lot of library files; adding -w will package it into an exe without a cmd window. If you don't add it, the cmd window will appear when running. (Add or not depends on personal preference)-F command
Note that commands are case-sensitive. It's capitalized here. Use the -F command to package the application into an independent exe file, otherwise it is a folder with various dlls and dependent files-p command
This After the instruction, you can add the path for pyinstaller to search for modules. Because application packaging involves many modules. You can add the path yourself here. However, after testing by the author, it can be recognized in the site-packages directory, and there is no need to manually add For more Python-related technical articles, please visit thePython Tutorial column to learn!
The above is the detailed content of Can python develop exe software?. For more information, please follow other related articles on the PHP Chinese website!