conda and pip

Both conda and pip are package management tools. Tools with syntax such as xxx install, xxx removecan basically be called package management tools. The difference between conda and pip is that

  1. conda can manage packages in any language, while pip can only manage Python packages.

  2. conda is generally integrated in anaconda. anaconda can provide an independent Python environment, which can specify the desired Python version and can use independent dependency packages. This environment is actually an independent folder.

  3. When pip installs packages with complex dependencies, if it encounters obstacles during the installation process, it may pollute the environment. The conda installation is relatively clean. If a package is found to be installed unsuccessfully, it will not pollute the original environment.

  4. Over 1,500 packages are available in the Anaconda repository for conda downloads, including the most popular data science, machine learning, and AI frameworks. PyPI, downloaded by pip, provides more than 150,000 software packages. So conda and pip are often used together.

In addition, it should be noted that when installing anaconda, a base environment will be automatically created for you. You can also use the conda command to create a new environment (new independent folder). Each conda environment has a specific version of the python interpreter, a specific version of pip, and other system-independent tools.

Basic commands of conda

  • conda create -n my_env python=3.9

    Create a my_env environment (that is, a folder named my_env) under anaconda/envs/. Changing the environment will install Python 3.9 version, and install some Python dependency packages and bin files by default.

  • conda rename -n my_env py39

    Rename my_env environment to py39

  • conda info -e

    List existing environments

  • conda list

    List the dependent packages installed in the default environment and their corresponding version numbers

  • conda list -n py39

    List the installed dependency packages and corresponding version numbers of the py39 environment

  • conda remove

    Delete the package in the current environment

  • conda remove -n py39 --all

    Delete all packages in the py39 environment, and then delete the py39 environment

  • For more instructions, you can output conda --help to see the prompts.

Guess you like

Origin blog.csdn.net/zmhzmhzm/article/details/130607281