Anaconda+Pycharm: Management and use of virtual environments

Anaconda+Pycharm: Management and use of virtual environments

Anaconda manages virtual environments

Install Anaconda and open Anaconda Promt
common commands

  • conda env list View the virtual environment on your computer
  • activate env_name (env_name, the name of your virtual environment.) Enter the virtual environment
  • deactivate env_name exit the virtual environment
  • conda remove -n your_env_name (virtual environment name) --all delete virtual environment
  • conda create -n test python=3.7 (test, the name of the virtual environment, 3.7 is the required py version) to create a virtual environment
  • conda install -n env_name installation package, note that you need to enter the corresponding virtual environment

Since the installation and download of many packages are very slow, the installation process is prone to errors. You can download and install manually here. Download website
: package download website.
During the download process, pay attention to downloading the corresponding py version of the package.
After downloading, store it in the root directory of the Anaconda Promt command line. , such as C:\Users\12638,
insert image description here
enter the command:
python -m pip install package_name
such as (python -m pip install GDAL-2.4.1-cp37-cp37m-win_amd64.whl)

Pycharm uses conda virtual environment

After completing the installation of the virtual environment in conda, enter Pycharm to set up. Add a
insert image description here
python interpreter, select conda environment->existing environment->select the python.exe file in the corresponding environment.
The path is in anaconda installation path \envs\ Your virtual environment name\python.exe
insert image description here

For package management, you can use pycharm for installation.
insert image description here
You can also use the above-mentioned method to first download the whl file of the package and then use anaconda to install it.

Guess you like

Origin blog.csdn.net/weixin_51205206/article/details/126155521