Three steps to teach you to easily install and configure the Linux Anaconda environment

1. Download the installation script

1. Enter Anaconda official website to get the download link:

image-20230725101427641

2. Pull the installation script remotely

wget https://repo.anaconda.com/archive/Anaconda3-2023.07-1-Linux-x86_64.sh

2. Formal installation

1. Run the script

bash Anaconda3-2023.07-1-Linux-x86_64.sh

Then follow the prompts to answer the corresponding questions (fill in yes if there are options, use spaces to skip when reading the agreement, and press Enter if there is a carriage return)

2. The configuration takes effect

source .bashrc

3. Configuration file

The configuration file .condarcis in the user's home directory (windows: C:\\users\\username\\, linux: /home/username/). But for .condarcthe configuration file, it is an optional (optional) runtime configuration file, which does not exist by default, but when the user runs the command for the first time, the conda configfile will be created in the user's home directory.

1. Create ~/.condarc

conda config

2. Configure ~/.condarc

channels:
  - defaults
  - conda-forge
show_channel_urls: true
default_channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  opencv: http://conda.anaconda.org/menpo
ssl_verify: false

custom_channels can be added later as needed, for example, opencv needs to be pulled from the specified channel, we can specify the channel when installing, as follows

conda install --channel https://conda.anaconda.org/menpo opencv3

Or directly configure the channel of opencv in custom_channels in the above configuration file

3. The configuration takes effect

Finally, run the following command to clear the index cache and ensure that the index provided by the mirror site is used.

conda clean -i

Note that every time you change the configuration file ~/.condarc, you need to execute the above command to make the configuration take effect

Encounter problems

问题:PackagesNotFoundError: The following packages are not available from current channels

plan 1

From the error report, you can see that you need to go to https://anaconda.org, search for other channels you want to install this package on the search bar above, and show how to find other channels of igraph below

Scenario 2

Download the .bz2 file from the official website and use the following command to download

conda install --use-local python-igraph-0.8.3-py38h0d6bca7_2.tar.bz2

Problem: Anaconda3 solving environment is very slow

1. Install mamba

conda install -n base --override-channels -c conda-forge mamba 'python_abi=*=*cp*'

Note: The above installation method is not officially recommended, you can check the official website to find the latest installation method

2. Then you can use the following command

mamba install package name

mamba remove package name

running into problems (windows)

Problem: The internal reason of powershell failed to integrate with conda

plan

1. Upgrade conda

conda update conda
conda update anaconda

2. Integrate powershell (need to be executed in powshell environment)

conda init powershell

Problem: CondaHTTPError: HTTP 000 CONNECTION FAILED for url

plan

1.channel https - > http

2. Turn off the proxy

Try using the anaconda prompt shell environment

reference article

Conda configuration file, change domestic source - stardsd - Blog Garden (cnblogs.com)

CentOS 7 installs Anaconda and simple configuration

recommended reading

Conda installation and use under linux and windows systems

Conda command complete set - Zhihu (zhihu.com)

User guide — conda documentation

Anaconda Chinese website

Guess you like

Origin blog.csdn.net/m0_63748493/article/details/131914092