Conda creates a python virtual environment under Windows

1. First install Anaconda in your system. You can open the command line and enter conda -V to check whether it is installed and the current version of conda.

2. Conda commonly used commands.

    1) conda list to see which packages are installed.

    2) conda env list or conda info -e to see which virtual environments currently exist

    3) conda update conda check to update the current conda

3. Create a python virtual environment.

     Use the conda create -n your_env_name python=XX (2.7, 3.6, etc.) command to create a virtual environment with python version XX and name your_env_name. The your_env_name file can be found under the envs file in the Anaconda installation directory.

4. Use an activated (or switch between different python versions) virtual environment.

    Open the command line and enter python --version to check the current python version.

    Windows: activate your_env_name (virtual environment name)

5. Install additional packages in the virtual environment.

    Use the command conda install -n your_env_name [package] to install the package into your_env_name

     For example conda install -n multiple_future attrdict==2.0.1

6. Close the virtual environment (that is, exit from the current environment and return to using the default python version in the PATH environment).

   Just use the following command.

   Linux: source deactivate

   Windows: deactivate

7. Delete the virtual environment.

   Use the command conda remove -n your_env_name (virtual environment name) --all to delete.

8. Delete a package in the environment.

   Just use the command conda remove --name your_env_name package_name.

Guess you like

Origin blog.csdn.net/weixin_36184353/article/details/122360969