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
Read More:
- Install python’s C extension compilation environment under windows (solve “error: command’cl.exe’ failed: No such file or directory”)
- Install Python C extension compiler environment under windows (solve “error: command” cl.exe ‘ failed: No such file or directory”)
- Error occurred when Python installed the pocketsphinx module (package): Command‘ swig.exe “Failed: no such file or directory
- When python installs pocketsphinx module (package), an error is reported: command ‘swig.exe’ failed: No such file or directory
- Can’t find Python executable “D:\python3\python.exe”, you can set the PYTHON env variable.
- Python packaged *. Exe is running os.popen (cmd)/ subprocess.Popen *. Exe crashes with invalid [winerror 6] handle
- Windows batch script opens hosts
- Python uses cxfree to package script files into executable programs
- Package python3.1 + PyQt4 into exe
- Error BC: command not found when git bash runs shell script
- Windows Java application startup batch script
- Shell script running error bash: JPS: command not found
- Running trust error reporting linker ‘link. Exe’ not found on Windows
- The python version output from the command line is inconsistent with the python version in the current CONDA environment
- Error reported when debugging Hadoop cluster under windows failed to find winutils.exe
- runtime error program:c :\windows\ explorer.exe (appears after installing the win8 security update) why?
- Python – [encoding] in Python os.system Solution to Chinese garbled code when calling CMD command
- To solve the problem that windows Remote Desktop Services cannot copy and paste: restart rdpclip.exe
- Solution to prompt “error opening terminal: xterm.” when making menuconfig
- Python windows error: [error 3] and common windows error errors