Here are some resources for more information about topics covered in this lesson:
Setting Up Python on Ubuntu Linux
00:06 You’ll learn how to install Python and how to open the Integrated Development and Learning Environment, also known as IDLE. While installing Python on other Linux flavors is similar, the process you see in this video is specific to Ubuntu Linux and Ubuntu version 20.04 in particular.
00:36 Before you see how to install the latest version of Python, you should know that Ubuntu Linux comes with an outdated version of Python out of the box. To see that, go ahead and open a terminal window.
Inside of the terminal, type
python3 --version and press Enter. On my installation, I see that Python 3.8.5 is installed. You might see something different, but if you’ve never installed Python on your computer before, then you can rest assured that this version is out of date.
01:35 The version of Python that comes pre-installed on your computer is called system Python and you don’t want to use it. Let’s talk about why. System Python is the version of Python that comes pre-installed on your computer.
01:49 Your computer requires system Python in order to function properly because it’s used by some aspects of the operating system. You should never attempt to uninstall system Python. Doing so could cause irreversible damage to your operating system and you might be forced to wipe your hard drive and re-install Ubuntu.
One way is to use a package manager, such as
apt, which stands for Advanced Package Tool. The
apt package manager is used to install software from Ubuntu’s Universe repository, which is a server that hosts a collection of software maintained by Canonical, the entity responsible for developing Ubuntu Linux.
apt from a terminal window. You can also install Python by compiling it from source code. You might want to do this for a couple of different reasons, such as compiling a custom version of Python for use on devices with limited memory or for accessing beta versions of Python for testing.
Compiling Python from source is an advanced process. In this lesson, you’ll be installing Python with the
apt package manager. If you’d like to see how to compile Python from source, you can find full instructions in Real Python’s Python 3 Installation & Setup Guide, which is linked in this video’s description.
These privileges are needed to make changes to your computer and its configuration, including installing some kinds of software. Running commands with
sudo will require you to enter your Ubuntu user password.
update command tells
apt to download package information so that your computer receives updated information about all of the packages in the Universe repository. So in short,
sudo apt-get update tells your computer to get updated information about all of the packages you can install, including Python, using superuser privileges.
update is done running, you’re ready to install Python. But before you do that, there’s a few things to be aware of. Python is available in a package called Python 3.9 in Ubuntu’s Universe repository. Note that Python 3.9 is the latest version of Python available at the time of this recording. For the most up-to-date package name, you can refer to Real Python’s Python 3 Installation & Setup Guide, which is linked in this video’s description.
python3.9 package only includes the Python interpreter, which is a command line tool used to run Python programs. The package is missing two important add-ons:
pip, which is Python’s own package manager used to install third-party Python packages, and IDLE, which is Python’s Integrated Development and Learning Environment.
You’ll be using that throughout the Python Basics video series to interact with Python. So, in addition to the
python3.9 package, you’ll need to install two additional packages to get
pip and IDLE.
pip is available in the
python3-pip package and IDLE is available in the
idle-python3.9 package. Let’s head on back to your desktop now to see how to install all three of these packages. In your terminal window, enter the command
sudo apt-get install python3.9 python3-pip idle-python3.9.
Ubuntu will show you some information about the packages you’re installing and ask whether or not you’re sure you want to continue. Type
y for yes and press Enter to continue with the installation.
07:12 That’s because the Ubuntu Universe repository is generally behind Python releases. If you’d like to see how to install the latest and greatest version of Python, check out Real Python’s Python 3 Installation & Setup Guide, linked in this video’s description. For our purposes, 3.9.0 will work just fine.
08:01 This opens the IDLE shell window. At the top of the screen, you’ll see the version of Python running as well as some information about the operating system. Below this information are three red right angle brackets. These are called a prompt.
The next time you want to open IDLE, open a terminal window by right-clicking on your desktop and selecting Open in Terminal, then typing either the
idle-python3.9 commands and pressing Enter.
08:50 So, there you go! You now know how to install Python on Ubuntu Linux and how to open IDLE, Python’s Integrated Development and Learning Environment. If you’d like to learn how to install Python on other operating systems, feel free to watch the other lessons in this course.
Become a Member to join the conversation.