Anaconda's installation and use

Posted by danf_1979 on Wed, 09 Feb 2022 07:08:24 +0100

1, Download Anaconda

Official website address:

Download steps

1. Click Get Started

2. Click Download Anaconda installers

3. Select the corresponding system

4. Select the number of digits corresponding to the system

2, Install Anaconda

1. Find the downloaded installation package and right-click to run as administrator

2. Next step

3. Consent agreement

4. Next step

5. Select the installation path and the next step

6. Recommended by default, installation

7. Wait for the installation to complete, next step

8. Next step

9. Complete installation

3, Use Conda to manage Python environment in Anacobnda

1. Run Anacobnda as Administrator

2. Upgrade Anaconda

conda update conda

When prompted whether to update, enter y(Yes) to continue the update

3. Create environment

conda create -n env_name package_names         


env_name: represents the name of the environment

package_name: represents the package name

Example 1: to create an env_test_01 and install the latest Python version 3,

conda create -n env_test_01  python=3

After creation

conda create -n env_test_01 python=3

Example 2: create an environment named Python 3.7 and install pandas version 0.24.0

conda create -n  env_test_02  python=3.7 numpy pandas=0.24.0

Effect after completion

4. Switching environment and its operation

1. Enter the environment

conda activate  evn_test_01        //evn_test_01 is the environment name

2. View the packages installed in the environment

conda list

3. Two ways to view the Python version of the current environment

python –version  
python -V            //Capital V

Exit the current environment

conda deactivate

5. Environment sharing

Export current environment

conda env export > environamet.yaml

Export the current environment (and specify the export path)

conda env export > L:\environamet.yaml

Import environment

1. Enter the environment

conda env activate  env_test_01         //Enter environment env_test_01

2. Update environment

conda env update -f=L:\environment.yml    // -f stands for setting path. L: \ is the local path

List environment

conda env list          //Lists the current environment

Delete environment

conda env remove -n  env_test_01  //Remove environment env_test_01

View current environment information

conda info

3, Using conda to manage Python packages in Anaconda

1. Enter the environment

conda activate  env_test_01      //Enter environment env_test_01

2. Search for the appropriate package

Does the repository provide this package

conda search requests             //Search for packages related to requests

3. Install the appropriate package

conda install  requests             //Install the package related to requests

Install pandas package

If the repository library does not have the desired package, it can also be installed through CONDA forge maintained by the community

conda install -c conda-forge pandas   //pandas installed through community maintenance

4. Uninstall package

Uninstall the package for the current environment

conda uninstall packages_name    //Uninstall the current packages_name package

Uninstall the package for the specified environment

conda uninstall my_env packages_name  //Uninstall my_ Packages in Env environment_ Name package

5. Upgrade package

Upgrade packages already installed in the specified environment

conda update my_env packages_name   //Upgrade my_ Packages in Env environment_ Name package

Upgrade package for current environment

conda update --all           //Upgrade all packages in the current environment

6. Libraries added and deleted for Anaconda (domestic images)

Add a new library

conda config --add channels  

View the currently owned image address

conda config --show-sources 

Delete added Libraries

conda config --remove channels

4, Configure environment as required

Environment 1:

Python3.7.3 Tensorflow-gpu 1.13.1 Numpy1.16.3

conda create -n env_test_03 python=3.7.3 Tensorflow-gpu=1.13.1 Numpy=1.16.3

Environment 2:

python 3.10.0 Tensorflow-gpu 2.8.0 Numpy 1.22.1

conda create -n env_test_04 python=3.10.0 Tensorflow-gpu=2.8.0 Numpy=1.22.1

conda create -n env_pythonB python=3.10.0 Tensorflow-gpu=2.8.0 Numpy=1.22.1

Error reporting information

Troubleshooting errors

Search the packages tensorflow GPU and numpy and find that the highest version of tensorflow GPU is 2.6.0 and numpy is 1.21.5

They all changed to their highest version and found that they were incompatible

Let the system install the corresponding version by default

conda create -n env_test_04 python=3 Tensorflow-gpu=2 Numpy=1

It is found that the system has selected the following version

conda create -n env_test_04 python=3.9.7 Tensorflow-gpu=2.6.0 Numpy=1.21.5

Installation completion effect

pycharm test effect

Topics: Front-end css3 css AI