Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the anaconda installation library commands in Python

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail what are the anaconda installation library commands in Python. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Enter the command here:

Operation command:

1. Update Anaconda:

Conda update conda

Update all packages

Conda update-all

3. Add Tsinghua Source

Execute the following command conda config-- add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config-- add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/conda config-- set show_channel_urls yes

Configure Tsinghua Mirror Source

First of all, enter the command line conda config-show channels can display all the channels information, generally defaults source, download speed is relatively slow, not very friendly, Tsinghua source mirror resource package is complete, download speed, so often configured as Tsinghua source.

The Tsinghua site also provides the image address of the conda installation package. Enter the following command line:

Conda config-add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config-add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/conda config-set show_channel_urls yes

If you want to delete a source, it's also easy to use the remove command, for example:

Conda config-- remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

For example, use pip Tsinghua Source to install pip install tensorflow==2.1.0-I https://pypi.tuna.tsinghua.edu.cn/simple

one

Commonly used conda commands

Update conda version: conda update conda

Upgrade anaconda: conda update anaconda

Query conda information: conda info

Query package installed by conda: conda list

Installation package: conda install package_name

Install the specified version of the application: the version specified by conda install package_name=

Delete installation package: conda remove package_name

Update installation package: conda update package_name

Sometimes we need to create multiple virtual environments in conda to isolate different versions of toolkits required by different projects to prevent version conflicts. You can also set up Python2 and Python3 environments to run different versions of Python code.

Show all environments: conda env list

View environment information: conda info-envs

Create a virtual environment: conda create-n environment name python= specifies the python version

Copy the existing environment: conda create-- name new_env-- clone old_env

Enter the created virtual environment: source activate environment name

Delete environment: conda env remove-n environment name

Exit the current environment: source deactivate

Package Management installation package

Format:

Install a package:

Conda install package_name-package_name is the name of the package

For example, to install numpy, type in Anaconda Prompt (terminal):

Conda install numpy

Install multiple packages at the same time

For example, to install pandas,numpy, type in Anaconda Prompt (terminal):

Conda install pandas numpy

Specify the version of the package

For example, to install numpy=1.14, type in Anaconda Prompt (terminal):

Conda install numpy=1.14

To specify the environment installation package, you can enter the following command to install numpy

For example, to install numpy in a python36 environment, type in Anaconda Prompt (terminal):

Conda install-n python36 numpy

Remove package

Format:

Conda remove package_name

Remove a package

For example, to remove numpy, type in Anaconda Prompt (terminal):

Conda remove numpy

To specify the environment removal package, you can enter the following command to remove numpy

For example, to remove numpy in the python36 environment, type in the Anaconda Prompt (terminal):

Conda remove-n python36 numpy

Update package

Format:

Conda update package_name

Update all packages in the environment

In Anaconda Prompt (terminal), enter:

Conda update-all

Specify that the environment update package can update numpy by entering the following command

For example, update the numpy in the python36 environment and enter in the Anaconda Prompt (terminal):

Conda update-n python36 numpy

Information about the package

List installed packages

View all packages

In Anaconda Prompt (terminal), enter:

Conda list

Query installed packages for a specified environment

In Anaconda Prompt (terminal), enter:

Conda list-n python36

Query the information of the package

Format:

Conda search package_name

For example, here is the information about the query package numpy

Conda search numpy

Note:

1. If multiple environments are created with the command on the terminal, but the created environment is not displayed in Jupyter Notebook, you need to install the package nb_conda to automatically associate the Anaconda environment with Jupyter Notebook. Execute the command as follows:

Conda install nb_conda

2. Create a new python environment, such as 3.6, and run

Conda create-name python36 python=3.6

After that, conda only installs python 3.6-related required packages, such as python,pip, etc. If you want python36 to be like the default environment, enter it in Anaconda Prompt (terminal):

Conda create-n python36 python=3.6 anacondaconda create-n python36 python=3.6 anaconda

On "what are the anaconda installation library commands in Python" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report