How to configure the virtual environment of anaconda in pycharm

Friends who don't want to read the text can also watch the following video:
The correct way to open Anaconda and Pycharm in Python learning

Environment configuration

The configuration of the environment is divided into three steps: configure the virtual environment and the packages required by the installer and open the project in pycharm

Configure the virtual environment

Configuring the virtual environment needs to be done through anaconda . The download address of anaconda is:

Windows users can download miniconda of python3.8


After the download is complete, double-click to install it. Note that these must be selected.



After the program is installed, open the Windows command line (cmd), enter conda env list, and the following information appears, indicating that conda has completed the installation


Enter the following command on the command line to create a virtual environment

conda create -n tf2.3 python==3.7.3
  • 1

The meaning of this instruction is to create a virtual environment with python version 3.7.3 and name tf2.3


After the installation is complete, enter the following command to activate the virtual environment. The parentheses shown in the figure below indicate that the environment is successfully activated.

conda activate tf2.3 
  • 1


Packages required by the installer

Then execute the following commands in sequence on the command line to install the packages required by the program (please choose the packages to be installed freely according to your program)

pip install tensorflow-cpu == 2.3.0 -i
pip install pyqt5 -i
pip install pillow -i 
pip install opencv-python -i 
pip install matplotlib -i 
  • 1
  • 2
  • 3
  • 4
  • 5


Note: Each line of commands must be executed

open program in pycharm

For the convenience of viewing and debugging the code, we use pycharm here. The download address of pycharm is:


Here you can choose the community version to download

Please be sure to select these options during the installation process to avoid unnecessary trouble later


After the installation is complete, find our code and open it through pycharm


After opening, we will find in the lower right corner of the softwareAdd interpreterAdd the virtual environment you just created



Finally, tf2.3 is displayed in the lower right corner, indicating that our current virtual environment is tf2.3


When installing the program package later, open the terminal directly under pycharm and executepip install xxxcommand, the package will be automatically installed in the current virtual environment


Tags: How to configure the virtual environment of anaconda in pycharm

Programming environment configuration

Related: How to configure the virtual environment of anaconda in pycharm