Conda commonly used commands

  1. Create environment:conda create --name 环境名称

          Purpose: Used to create a new Conda environment, you can specify the name of the environment.

  2. Activate the environment:conda activate 环境名称

          Purpose: Used to activate the Conda environment with the specified name.

  3. Disable the environment:conda deactivate

          Purpose: Used to deactivate the currently activated Conda environment.

  4. Delete the environment:conda remove --name 环境名称 --all

          Purpose: It is used to delete the Conda environment with the specified name, and --allthe parameter indicates to delete the environment and all its installed packages.

  5. Installation package:conda install 包名称

         Purpose: Used to install the specified package in the current environment.

  6. Upgrade package:conda update 包名称

        Purpose: Used to update the version of an installed package.

  7. Uninstall the package:conda remove 包名称

         Purpose: Used to uninstall the specified package from the current environment.

  8. View installed packages:conda list

        Purpose: Used to list installed packages in the current environment.

  9. Search package:conda search 包名称

          Purpose: Used to search for specified packages in the Conda repository.

  10. Create an environment configuration file:conda env export > environment.yaml

          Purpose: It is used to export the configuration of the current environment into a YAML file for copying or rebuilding the environment elsewhere.

  11. View configuration information:conda config --show

          Display the current Conda configuration information, including common configuration, environment configuration and user configuration.

  12. View the value of a configuration item:conda config --show 配置项

         Display the current value of a specific configuration item, for example: conda config --show channelsused to display the currently configured channel list.

  13. Set the value of the configuration item:conda config --set 配置项=值

        Example: conda config --set channels conda-forgefor setting the channel to conda-forge.

  14. Add channel:conda config --add channels 通道名称

         Adds a new channel to the configuration to make Conda prioritize that channel when searching and installing packages.

  15. Remove the channel:conda config --remove channels 通道名称

         Removes the specified channel from the configuration so that Conda no longer uses that channel.

  16. List all channels:conda config --get channels

          List all configured channels in the current configuration.

  17. Reset configuration items:conda config --remove-key 配置项

          Reset the value of the specified configuration item to the default value.

  18. Edit the configuration file:conda config --edit

         Opening the configuration file for manual editing allows modification of various configuration options.

  19. Create an environment with a specified version:

    conda create --name myenv python=3.10.6

  20. Export and import environment configuration from environment

  Export environment configuration

  conda env export --name myenv --file environment.yaml

  Import environment configuration

  conda env create --file environment.yaml

  21. Create a clone of the virtual environment:

  conda create --name myclone --clone myenv

Guess you like

Origin blog.csdn.net/forgetmiss/article/details/107787693