Making Python script into exe command under Windows
Method 1: use windows batch processing (Windows command script)
- create a new
fanyi.bat code> file, which is as follows. OL>
@echo off
python3 D:\test\fanyi.py %1
add the current folder to the environment variable, re open a CMD window, and enter the command Fanyi Hello code> OL>
The second method uses pyintaller module to generate EXE file
install pyinstaller module
pip install pyinstaller
enter the D: [test code> directory, and execute the generate command OL>
pyinstaller fanyi.py
Generated fanyi.exe The code> file is in the D::
add the folder to the environment variable and execute the command in CMD