CentOS7 platform command to install Anaconda3 and configure Python3 development environment

To install Anaconda3 on CentOS 7, you can follow these steps:

1. Download the Anaconda3 installation package:

First, visit the Anaconda official website to get the download link for the latest version of the Anaconda3 installation package. You can use the wget command to download the installation package. Make sure to select the version for CentOS 7.

wget https://repo.anaconda.com/archive/Anaconda3-<version>-Linux-x86_64.sh

Please replace with the Anaconda3 version number you want to install. For example, if you want to install version 2021.05, you should replace 2021.05 in the above command.
Insert image description here

2. Execute the installation script:

Use the following command to run the Anaconda3 installation script:

管理权限:su -

命令安装:

bash Anaconda3-<version>-Linux-x86_64.sh

或 sudo bash Anaconda3-<version>-Linux-x86_64.sh

或指定路径:bash Anaconda3-2023.07-2-Linux-x86_64.sh -p /opt/conda/ -u


Follow the prompts and follow the instructions of the installer to complete the installation. You may need to read and accept the license agreement, and then select an installation location (by default, Anaconda3 will be installed in the user's home directory).

3. Environment configuration and initialization Anaconda3:

Enter the /etc/profile or ~/.bashrc file and add the following two lines of code at the end of the file

PATH=$PATH:/opt/conda/bin  #路径名跟自己实际情况而定
export PATH

Enter the environment:

vim /etc/profile
vim ~/.bashrc

Once the installation is complete, Anaconda3 can be initialized by running the following command:

source ~/.bashrc

Or you can restart the terminal for the initialization to take effect.

4. Verify Anaconda3 installation:

Run the following command to verify that Anaconda3 was installed successfully:

conda --version

This should display the Anaconda3 version number, proving the installation was successful.
Insert image description here

Enter the environment:

conda activate  或 source activate

In some cases, conda activate cannot be used. You can use source activate instead:
Insert image description here

5. If you feel that the installed version is too old, you can update Anaconda3:

To ensure that your Anaconda3 installation is up to date, you can run the following command to update it:

conda update conda
conda update anaconda

This will ensure you are using the latest version of Anaconda3.

6. Supplementary instructions

If your user is not added to the /etc/sudoers file, you will not be able to use sudo commands to escalate privileges. However, you can use one of the following methods to resolve this issue:

  1. Use su to switch to the superuser account:

Run the following command in the terminal to switch to the superuser (root) account:

su -

This will ask you to enter the superuser (root) password. Once you switch to the superuser account, you will have full system administration rights and can perform any operation. Use superuser privileges carefully to ensure that you do not accidentally change system settings.

  1. Ask your system administrator to add you to the sudoers file:

If you need to execute sudo commands under a regular user account, you can contact your system administrator (or another user with sudo permissions) to add you to the /etc/sudoers file. This requires administrator rights to edit the file.

Use su to switch to the superuser (root) account (as described above).

Open the /etc/sudoers file and edit it using the visudo command:

visudo

Find the following lines in the file:

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

Below that line, add your user account and permissions that allow sudo. Here is an example:

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
your_username   ALL=(ALL)       ALL

Make sure to replace your_username with your actual username.

Save and exit the editor.
You should now be able to use sudo commands to perform operations with administrator privileges.

Note: Editing the /etc/sudoers file requires caution as incorrect changes may cause system problems. If you're not sure how to edit, ask your system administrator or someone with more experience.

reference

Download address: https://repo.anaconda.com/archive/
https://blog.csdn.net/WHQ556677/article/details/122283578

Guess you like

Origin blog.csdn.net/weixin_41194129/article/details/133132000