Introduction
Anaconda is a package manager used mostly frequently in data science. It manages scientific libraries and dependencies for the Python programming language. While Anaconda is typically used in machine learning and artificial intelligence applications, it also works as a stand-alone package manager.
This guide will show you how to install Anaconda on CentOS 7.
Note: This guide is also available for Ubuntu 18.04 & CentOS 8.
Prerequisites
- A user account with sudo privileges
- A web browser
- Access to a terminal window / command line (Ctrl-Alt-F2)
Steps For Installing Anaconda On CentOS 7
Step 1: Download the Latest Anaconda Version
Use a web browser to navigate to the Anaconda developer download page, and get a link for the latest version of Anaconda.
At the time this article was written, the latest version was 2019.07.
Click the Linux tab on the Downloads page, then pick the version that syncs with your version of Python. (Most users will want the version for Python 3.7. If your configuration has you using Python 2.7 for a specific reason, choose that version instead.)
Take note of the link to the download file. You can either choose to download to your /tmp
directory, or use a command line to download using curl
:
cd /tmp
curl –O https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
If you get an error that the curl command was not found, install it by entering:
yum install curl
Step 2: Verify Anaconda Download Integrity
Once the download finishes, compare the checksum:
sha256sum Anaconda3-2019.07-Linux-x86_64.sh
Compare the output to the appropriate hash in the Anaconda Documentation. For version 2019.07, it should read as follows:
69581cf739365ec7fb95608eef694ba959d7d33b36eb961953f2b82cb25bdf5a
The terminal will display the following information:
Step 3: Update Anaconda
One quirk of the Anaconda package is that the conda software must be updated before the full Anaconda package is installed. Start by entering the following:
conda update conda
Once the update finishes, update Anaconda by entering the following:
conda update anaconda
Step 4: Run Anaconda Installer Script on CentOS
Anaconda uses a bash script to install.
To install Anaconda on CentOS enter the following:
bash Anaconda3-2019.07-Linux-x86_64.sh
If you get an error that the bunzip2 command is not found, load it first by entering:
yum install bzip2
The system will welcome you to the installer, then ask you to review and approve the license terms. Do so, then press Enter to continue.
You’ll be asked to agree to the terms – type yes to continue.
The system will prompt you to use the default installation location (/home/user/amaconda3).
Press Enter to continue or specify your location. You may cancel the installation if necessary. It is recommended to use the default installation location unless you have a specific need to change it.
The installer will run and finish.
In the end, it will ask if you want to “prepend the Anaconda3 install location.” This gives you the ability to run the conda
command from any directory. Select yes, unless you need to say no. (Saying no means you must run conda
by changing to the Anaconda3 directory first.)
The installer will execute your choice, then offer to install Microsoft Visual Studio Code. Type yes or no, and the installer will continue.
Step 5: Verify Anaconda Installation
To verify a sucessful install of Andaconda, load the path variable:
source ~/.bashrc
This will refresh the path to the conda
command, allowing you to run the package from any directory.
Next, enter the command:
conda info
The system should display information of your sucessful Anaconda installation.
How to Uninstall Anaconda on CentOS
1. To uninstall Anaconda, start by removing the installation directory:
rm –rf ~/anaconda3
.2 Edit the path
variable, which adds the Anaconda directory to the default path:
sudo nano ~/.bashrc
3. Locate the section marked as added by Anaconda. You can then either delete the code or comment it out by adding a hashtag # at the beginning of each line.
4. Finally, remove Anaconda’s hidden files:
rm -rf ~/.condarc ~/.conda ~/.continuum
Conclusion
By following this tutorial, you have successfully installed Anaconda on your CentOS 7 system. You can also use the same installation process to update Anaconda when newer versions become available.
原创文章,作者:506227337,如若转载,请注明出处:https://blog.ytso.com/222895.html