Use anaconda to package the python program

  1. Changing the download source to a domestic source can improve the slow download speed of third-party packages. For details on how to modify the conda download source, see: https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
  2. Create a new environment in the base environment
  3. conda env list #View environment
  4. switch to new environment
  5. Install pillow and pyinstaller packages in the new environment
    conda install pillow
    conda install pyinstaller

  6. Other packages required to install applications in the new environment, taking pygame as an example
    conda install pygame 或
    pip3 install pygame

 7. Enter the folder where the program is located and package the program with pyinstaller

pyinstaller -F  xxxx.py

For example, if your python program is music_player.py, the command to turn the python program into an executable file is

pyinstaller -F  music_player.py

After packaging with pyinstaller, an executable program named music_player.exe will be generated in the dist folder.

Guess you like

Origin blog.csdn.net/m0_73962437/article/details/127070150