Python is a powerful tool, but the. py file that we generate needs to be converted to an. exe file in the absence of a python environment, and I'm using Pyinstaller
1, installation Pyinstaller:
Pip Install Pyinstaller
2. Write the PY program in advance.
3.
cmd into the extracted directory, execute the following command:
Python pyinstaller.py [opts] yourprogram.py
The main options are:
-F,-onefile packaged as an EXE file
-D,-onedir creates a directory that contains EXE files but relies on many files (default option)
-C,-console,-nowindowed use console, no interface (default)
-W,-windowed,-noconsole using Windows, no console
4, I follow the method of 3 to perform the display error, the hint can not find pyinstaller.py, I found the Pyinstaller.exe file under the E:\ProgramData\Anaconda3\Scripts folder (not installed Anaconda3 's friends may be found in the Python installation directory of Scripts ). My approach is to:
Enter cmd under the E:\ProgramData\Anaconda3\Scripts folder, execute command: Pyinstaller.exe [opts] yourprogram.py
Example:pyinstaller.exe-f E:\Pythonchengxu\test.py
The generated. exe file will be found in E:\ProgramData\Anaconda3\Scripts\dist after success
Convert a python. py file to an executable file. exe