Python virtual environment package exe

created at 12-29-2021 views: 23

why virtural environment

If you do not create a virtual environment, the packaged exe file is very large, so you need to create a virtual environment.

  • Anaconda3
  • Python3.8

The steps to establish a virtual environment are as follows:

View the virtual environment:

conda info --envs
conda create -n auto python==3.8 
# Create a virtual environment auto named myself

The created virtual environment is under envs in the anaconda installation directory:

virtual environment

# Activate the virtual environment
conda activate auto 

# Exit the virtual environment
conda deactivate

# delete virtual environment
conda remove -n aotu--all 

Install the required packages in the virtual environment

pip install pyinstaller


Switch to the place where the code and ico pictures are stored: use this command to package

Pyinstaller -F -i a.ico

after packaging:

after packaging

created at:12-29-2021
edited at: 12-30-2021: