Making Python script into exe command under Windows

Making Python script into exe command under Windows

Method 1: use windows batch processing (Windows command script)

    create a new fanyi.bat file, which is as follows.

    @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

      The second method uses pyintaller module to generate EXE file

        install pyinstaller module

        pip install pyinstaller
        
          enter the D: [test directory, and execute the generate command

          pyinstaller fanyi.py
          

          Generated fanyi.exe The file is in the D::

            add the folder to the environment variable and execute the command in CMD

Read More: