anaconda installation
Introduction to Anaconda
Anaconda (official website) is a distribution version that can easily obtain packages and manage packages, and can manage the environment in a unified manner. Anaconda includes more than 180 scientific packages including conda and Python and their dependencies.
Anaconda has the following characteristics:
- open source
- Simple installation process
- High-performance use of Python and R languages
- free community support
The implementation of its features is mainly based on what Anaconda has: conda package, environment manager, 1,000+ open source libraries
Anaconda installation
1. Installation process
First, enter its official website link: https://www.anaconda.com/ , and then download the installation package.
After the installation package is downloaded, double-click the exe to install. The process is as follows:
Remember to check add anaconda3 to my_PATH environment variable here . If you don’t check it, you need to configure the environment variable yourself.
Uncheck it, because some configuration needs to be added, modify the conda source to the domestic mirror source...
In the start menu bar, view, the installation is successful
2. Anaconda configuration modification
After the installation is complete, first use the black window cmd to enter the command conda --version 和 conda info
to check whether the installation is successful
Modify the conda source to the domestic mirror source (because when some third-party libraries are installed, the download is very slow or fails when using foreign countries):
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
It should also be noted here that if the above three commands time out, change https to http for testing, and it should be fine.
When setting the search, display the address of the channel
conda config --set show_channel_urls yes
View channel address
conda config --show channels
3. Create a virtual environment
View all virtual environments:
conda env list
Create a new custom virtual environment:
conda create -n 自定义虚拟环境名称 jupyter notebook
As shown in the following figures, the process of creating a virtual environment:
During the process of creating a virtual environment, libraries and packages will be reinstalled into the virtual environment:
View all virtual environments again conda envl list
, the custom virtual environment is created successfully
Next, open anaconda to see the virtual environment we just created:
Enter jupyter and test whether it can run normally
ok, jupyter can run normally
4. Common commands
conda list: view all packages in the environment
conda install XXX: install XXX package
conda remove XXX: delete XXX package
conda env list: list all environments
conda create -n XXX: create an environment named XXX
conda create -n env_name jupyter notebook : create virtual environment
activate noti (or source activate noti): enable/activate environment
conda env remove -n noti: delete specified environment
deactivate (or source deactivate): exit environment
jupyter notebook : open Jupyter Notebook
conda config --remove-key channels : switch back to the default source