Step 1: Update and Upgrade Your System
Before we begin, make sure your Ubuntu system is up-to-date. Open the Terminal application (Ctrl + Alt + T) and type the following commands:
sudo apt update
sudo apt upgrade
Enter your password when prompted. This will ensure all the existing packages on your Ubuntu system are updated.
Step 2: Download Anaconda
Navigate to the Anaconda distribution’s download page on your browser. You can find the latest version at this location.
For Ubuntu, you’ll want the Linux installer. Make sure to choose the Python 3.x version. Once the download is complete, note the location of the downloaded .sh file.
Step 3: Install Anaconda
Next, we’ll install Anaconda using the script we just downloaded. From your terminal, navigate to the directory containing the .sh file. You can do this using the cd
command. For example, if you downloaded the file to your Downloads folder, you’d use:
cd ~/Downloads
Next, make the script file executable, so that you can run it on your computer:
chmod +x Anaconda3-2023.03-Linux-x86_64.sh
Now, install Anaconda by running the .sh script. If your file has a different name, replace “Anaconda3-2023.03-Linux-x86_64.sh” with your filename:
./Anaconda3-2023.03-Linux-x86_64.sh
Follow the prompts on the installation screens. If you’re unsure about any setting, accepting the defaults is a safe bet. When the installation is complete, you’ll need to close and reopen your terminal.
Step 4: Verify Anaconda Installation
To verify the Anaconda installation, reopen the terminal and type:
conda list
This command should display a list of installed packages. If you see a list, congratulations! You’ve successfully installed Anaconda.
Step 5: Create a New Conda Environment
While not strictly necessary, it’s often beneficial to create a separate Conda environment for different projects. This can help manage package dependencies. To create a new environment, use:
conda create --name myenv
Replace “myenv” with the name you want to give to your new environment.
To activate this new environment, use:
conda activate myenv
Learn Computer Science with Python will be publishing a Conda quick reference soon, so keep your eyes open.
Conclusion
You’ve successfully downloaded and installed Python using the Anaconda distribution on your Ubuntu system. Now, you’re ready to start your journey in computer science with Python. Happy coding!