Linux installs Anaconda and configures the environment

Linux installs Anaconda/Miniconda and configures the environment


This article is mainly used to record some of the problems I encountered when using Anaconda/Miniconda to create a python virtual environment on the Feiteng Jiangniu development board (ARM architecture) .

1. Anaconda download

1. Official website download

Free Download | Anaconda

2. Tsinghua mirror download

Index of /anaconda/archive/ | Tsinghua University Open Source Software Mirror Station | Tsinghua Open Source Mirror

Download Linux 64-Bit (x86) installer

Note:

If you are installing Anaconda on ARM architecture, download the Linux 64-Bit (ARM64) installer

Otherwise, the following error will appear:
Insert image description here

If you download Linux 64-Bit (ARM64) installer and run the following error message:
Insert image description here

You need to lower the Anaconda version and use miniconda3 4.9 version to perfectly solve this problem.

Pull the conda installation package

wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux-aarch64.sh

2. Installation

Run in the downloaded installation package path

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

The version downloaded by the installation package will be different.

Press Enter to view the agreement and continue,

Until you see Please answer 'yes' or 'no' , enter yes ;

Insert image description here

3. Add environment variables

First, check whether Anaconda automatically configures environment variables:

source ~/.bashrc

Execute conda again. If the following figure shows that Anaconda has automatically configured the environment variables
Insert image description here

4. Conda manages virtual environment

1. Conda creates a virtual environment

Create a virtual environment

conda create -n my_env python=3.8.2

View existing virtual environments

conda env list

2. Conda activates the virtual environment

activation

conda activate my_env

Deactivate

conda deactivate

3. Cancel automatic entry into base environment

conda config --set auto_activate_base false

4. conda source change

Tsinghuayuan

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

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

5. conda manages installation sources

View installed sources

conda config --show-sources

Delete installation source

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

Restore default source

conda config --remove-key channels

pip source change

pip install pkg -i http://pypi.douban.com/simple

Other ways to change sources with conda

Use Vim to edit the .condarc file in the root directory

vim ~/.condarc
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/
  - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/
  - https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true

reference

Configuring the conda environment in Linux and changing the source - Zhihu (zhihu.com)

Anaconda replaces Tsinghua University and University of Science and Technology of China_StarDust's Blog-CSDN Blog

Installing miniconda on Raspberry Pi 4B 64-bit system (after struggling for a few days, I finally solved it)_miniconda3-py37_23.1.0-1-linux-aarch64.sh_LeslieWu's blog-CSDN blog

Steps to install Anaconda under Ubuntu (with pictures) - Zhihu (zhihu.com)

Guess you like

Origin blog.csdn.net/weixin_69035671/article/details/132024112