A library is required to convert a Py file to EXE. Install with the following command.
$ pip install pyinstaller
To make it an exe, enter the following. -If you add onefile, it becomes one file, -–Noconsole hides the console. To add an option, enter the command as follows.
$pyinstaller python filename--onefile --noconsole
If successful, a new folder called dist will be created. The EXE file is saved.
It would be nice if this could be converted to EXE. It may fail with an error similar to the following:
Recursion error : maximum recursion depth exceeded
If the above error is displayed, retry by the following means.
First, a file called "filename.spec" is saved when pyinstaller is executed. After opening this with Notepad etc., add two lines as follows.
# -*- mode: python ; coding: utf-8 -*-
import sys #Postscript
sys.setrecursionlimit(10000) #Postscript
block_cipher = None
If I can add it, I open PowerShell and run pyinstaller, One point needs attention. Execute pyinstaller on the spec file you edited earlier, not on the py file.
$pyinstaller edited spec file.spec --onefile --noconsole
I think that it can be safely converted to EXE. The EXE file is newly created in a folder called dist.
Recommended Posts