Reference article:
https://zhuanlan.zhihu.com/p/64930395
https://blog.csdn.net/knidly/article/details/80327166
0 Reference URL
Pull down to the bottom, copy the link to download
Anaconda official website: https://www.anaconda.com/products/individual#linux
Anaconda Tsinghua mirror source: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M & amp;O=D
x86_64 means compatible with 32-bit and 64-bit systems. Right-click to copy the link, and use wget to download in linux.
1. Download
1Install and download instructions
yum install wget
2Download
At present, the download speed of the official website is higher than that of the mirror source of Tsinghua University, just download directly from the official website
wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
2. Install
1Install instruction
bash Anaconda3-2021.11-Linux-x86_64.sh
2Input ENTER
ENTER
3 Enter all the way
4 Enter yes
yes
5Select path
Change to a path with more space
/data/anaconda3
5.1 may report an error
There may be an error here, suggesting that bunzip2 cannot be found:
Anaconda3-2019.03-Linux-x86_64.sh: line 353: bunzip2: command not found
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
Also use yum to install, the name is bzip2:
yum install -y bzip2
After the installation is complete, repeat the previous steps to install anaconda3
6 select no
It is recommended to enter no. If you choose yes, the environment variable is automatically added in the /root/.bashrc directory, which will automatically start the base environment when booting
no
7 Open profile file:
vi /etc/profile input i
8Change environment variables
Hold down the shift key + : key, type wq, save the file and exit.
Add the following statement at the end of the file (the path needs to be changed according to your own installation location): PATH=$PATH:/data/anaconda3/bin export PATH
9 Finally, use the following command to refresh the environment variables
source /etc/profile echo $PATH
10 Enter and exit the environment command:
new version
conda activate # Enter the conda environment, if (base) appears, the installation is successful conda deactivate # Exit the conda environment
old version
source activate # Enter the conda environment, if (base) appears, it means the installation is successful source deactivate # Exit the conda environment
11 initialization:
conda init
12 Restart the xshell software
13 anaconda cancels the default startup base environment every time
After installing conda, cancel the base that appears before the command line, and cancel the basic environment that automatically activates conda every time you start
method one:
Every time you exit the base environment through conda deactivate on the command line and return to the system automatic environment
Method Two
1. By setting the auto_activate_base parameter to false:
conda config --set auto_activate_base false
2. If you want to enter, pass
conda activate base
3. If you regret it and still want to keep the base, you can restore it through
conda config --set auto_activate_base true
14 Install cuda and cudnn in the conda virtual environment
This article takes cuda10.1 as an example:
Install CUDA in the conda virtual environment:
conda install cudatoolkit=10.1 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
or:
conda install cudatoolkit=10.1
Install cudnn in the conda virtual environment:
conda install cudnn=7.6.5 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/
or:
conda install cudnn=7.6.5
If the version is not written, the version will be automatically selected to match the cuda version:
conda install cudnn
The installation path here does not form a separate cuda folder, but is stored in the envs/your virtual environment/lib or include folder:
The figure below shows the path after installing CUDA and CUDNN.
The installation path here does not form a separate cuda folder, but is stored in the conda installation directory under the virtual environment lib and include folders under envs.
cd /data/anaconda3/envs/py38_insightface
15 Add CUDA to enter the environment variable
Multiple virtual environments only need to be added once
vim /etc/profile
PATH=$PATH:/data/anaconda3/envs/python38/lib LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/anaconda3/envs/python38/lib export PATH export LD_LIBRARY_PATH
source /etc/profile
16 Restart the xshell software
3. Configure the python virtual environment that requires the version
1 Enter conda -V to view the version
conda -V
2 Create a Python3.7 environment
conda create --name python37 python==3.7.4
3 Activate the environment
conda activate python37
4 cancel Python3.7 environment
conda deactivate
5Delete an existing environment
conda remove --name python37 --all
6 View the existing environment
The different python environments installed by the user will be placed in the directory ~/anaconda/envs. You can run conda info -e in the command to view the installed environment. The currently activated environment will be displayed with an asterisk or brackets.
conda info -e
7Pip mirror source modification Try to use pip install to install the package, conda may fail the mirror source
~/.pip/pip.conf (if not, create a folder and file. Add “.” to the folder to indicate it is a hidden folder)
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
One-click setup
pip3 config set global.index-url https://mirror.baidu.com/pypi/simple
8anaconda mirror source modification
#Display what are the current conda data sources conda config --show channels #Add data source: For example, add anaconda image: conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/ conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/msys2/ conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/ conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/menpo/ conda config --set show_channel_urls yes ? #delete data source conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ #Restore the default datasource conda config --remove-key channels
9 commonly used conda commands:
Conda commonly used commands: conda list to see which packages are installed. conda env list or conda info -e to see which virtual environments currently exist conda update conda Check to update the current conda 1) Check the installed packages in the current environment: conda list 2) Find package information: conda search XXXX (XXXX is the name of the package you are looking for) 3), install the package: conda install -n XXXX (environment name) XXXX (name of the package to be installed) # If the environment name is not specified with -n, it will be installed in the current active environment # You can also specify to install through a channel through -c 4), update the package: conda update -n XXXX (environment name) XXXX (name of the package to be updated) 5), delete package: conda remove -n XXXX (environment name) XXXX (package name to be updated)
10. Online upgrade
conda update -n base -c defaults conda
win10 installation, additional reference and configuration
Additional reference configuration for error reporting