In this article, we will guide you through the process of installing Python 3.8 in Lubuntu 18.04. Before we proceed, it’s important to note that changing the system-provided version of Python can potentially break your system. It is generally recommended to use a newer release of the operating system for newer software. However, if you still need to install Python 3.8 on your Lubuntu 18.04, here are two methods you can follow.
To install Python 3.8 in Lubuntu 18.04, you have two methods: using the deadsnakes PPA or building from source. The deadsnakes PPA provides a convenient way to install newer versions of Python, while building from source gives you more control over the installation process. Choose the method that suits your needs and follow the step-by-step instructions provided in the article.
- Method 1: Using the deadsnakes PPA
- Method 2: Building from source
Method 1: Using the deadsnakes PPA
The deadsnakes PPA is a Personal Package Archive that provides newer versions of Python for Ubuntu.
Step 1: Update the package list and install the prerequisites
First, we need to update our system’s package list. This ensures that we have the latest versions of all packages and their dependencies. Run the following command:
sudo apt update
Next, we need to install
software-properties-common, which provides the
add-apt-repository command. This command allows us to add PPAs to our system. Run the following command:
sudo apt install software-properties-common
Step 2: Add the deadsnakes PPA
Now, we can add the deadsnakes PPA to our system’s source list with the following command:
sudo add-apt-repository ppa:deadsnakes/ppa
Step 3: Install Python 3.8
With the deadsnakes PPA added, we can now install Python 3.8:
sudo apt install python3.8
Step 4: Verify the installation
To ensure Python 3.8 was successfully installed, you can check the version:
Method 2: Building from source
If you prefer not to use a PPA, you can build Python 3.8 from source.
Step 1: Install the necessary build dependencies
Before we can build Python, we need to install some dependencies:
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
Step 2: Download the Python 3.8 source code
Next, we’ll download the Python 3.8 source code from the official Python website:
Step 3: Extract the source code and navigate into the directory
Extract the source code and navigate into the directory:
tar -xf Python-3.8.5.tgz
Step 4: Configure and build Python
Now we can configure and build Python. The
--enable-optimizations option optimizes the Python binary by running multiple tests:
make -j 4
sudo make altinstall
Step 5: Verify the installation
Finally, verify that Python 3.8 was successfully installed:
In this article, we’ve shown you two methods to install Python 3.8 in Lubuntu 18.04. Remember to exercise caution when changing the system-provided version of Python, as it can have unintended consequences. It is generally recommended to use a virtual environment for development purposes instead of modifying the system-wide Python installation. If you want to learn more about Python, you can check out the official Python documentation.
Installing Python 3.8 on Lubuntu 18.04 can potentially break your system as it involves changing the system-provided version of Python. It is generally recommended to use a newer release of the operating system for newer software.