Anaconda download, installation, uninstallation and environment configuration
1. Download Anaconda
Enter the Anaconda official website and download the Linux version of anaconda (file ending in .sh)
2. Install Anaconda
1. Copy the file to Ubuntu and enter the command in the corresponding location sh 文件名.sh
to install (it is recommended to install under the root user)
2. Keep pressing the ENTER key until the page for selecting yes and no appears, and enter yes on the keyboard.
3. Select the installation location and enter the location you want to install (note: when installing anaconda here, it is best to install it in a directory that ordinary users can access, such as /usr/local, /opt, /home, otherwise ordinary users may not be able to use it normally )
If you only need to use anaconda under the root account, just press the ENTER key to select the default location. I installed it here under the default path /root/anaconda3
4. Initialize the conda environment: Enter yes on the keyboard to automatically configure the environment; enter no on the keyboard to customize the configuration environment later.
3.Anaconda’s environment configuration
1. Find the installation location of Anaconda. There will be a prompt for the default installation. It is usually home/username/anaconda3. I installed it under /root/anaconda3 this time. 2. Enter and edit the environment
variables vi ~/.bashrc
and add the following content:
export PATH="/自己对应的路径名/anaconda3/bin:$PATH"
Write your own corresponding path name here. Mine is export PATH="/root/anaconda3/bin:$PATH"
3. Activate the modified content: source ~/.bashrc
4. Test whether the configuration is successful: enter conda
, if not fond is not displayed, it means anaconda is installed and configured successfully.
4.Give ordinary users/super users permission to use Anaconda
Whether you install it under the root user or an ordinary user, when installing anaconda, it is best to install it in a directory that ordinary users can access, such as /usr/local, /opt, /home, otherwise ordinary users will not be able to use anaconda.
(1) Anaconda is installed under the root user, and you want to give ordinary users the permission to use anaconda.
For example, the installation location is /opt/anaconda3, execute directly under the ordinary user: /opt/anaconda3/bin/conda init bash
, and then execute conda env list
the test
(2) Anaconda installed under the ordinary user , you want to give the super user (root) permission to use anaconda.
For example, the installation location is /home/xxx/anaconda3, run directly under the root user: /home/xxx/anaconda3/bin/conda init bash
, and then execute conda env list
the test
5. Uninstall Anaconda
If you accidentally install anaconda in a directory that is inaccessible to ordinary users, such as /root or /home/root, you can uninstall anaconda and reinstall it.
(1) Delete the installation directory: rm -rf /root/anaconda3
(2) Edit the environment variable file vi ~/.bashrc
and comment or delete the path of anaconda3
(3) Make the modified environment variables take effect immediately:source ~/.bashrc