Verify Ubuntu Python Installation
Be sure you have installed Python 2 before the 3rd Python Installation. Get a terminal open and type in this command:
To confirm that Python 3 is installed on your Ubuntu machine, look for the version in the result. You can also view more details on licensing, copyright, etc. You can close the prompt by pressing Ctrl+D.
If you encounter an error message such as “bash: python3: command not found,” it indicates that Python is not configured or installed.
Ubuntu users can Python installation.
On Ubuntu, you may Python installation in multiple ways:
Using APT. Use Ubuntu’s default repository to install the most recent version.
This is based on the code itself. Please download the most recent release from Python’s official website and install it.
It’s in the form of a PPA. To Python installation on Ubuntu, go to the Deadsnakes PPA, a third-party repository.
You can find detailed instructions for each installation technique below, allowing you to pick the best option.
Method 1: Installation of Python with APT-based
Installing Python in Ubuntu is as simple as using the apt package manager and the system’s default repository. Although this is the simplest option, it might only sometimes deliver you the most recent version of Python. You can always find the most recent versions on the official website or a third-party repository.
Please proceed as follows:
Step 1: Repository Update
For the most up-to-date software, always check the package repository. Execute the instructions below:
Step 2: Python Installation
Execute the following command to install Python after the package repository information has been updated:
To begin using Python, you must wait for the installation to complete.
Step 3: make sure the installation is completed.
It is recommended to check the program version to ensure a successful installation:
Method 2: Install Python Binary
You can get the source code from the official developer and compile it this way. Although it is more involved, getting to a newer version of Python is worth it.
Please proceed as follows:
Step 1: Repository Local Updates
Refresh the local package archives:
Step 2: Set Up Complementary Programmes
Further software is needed to compile a package from the source code. The following command will install the necessary Python packages:
Step 3: get the most recent Python source code.
- use the cd command to go to the /tmp directory.
Source code is frequently downloaded to the /tmp directory for straightforward cleanup after installation because it is designated for temporary storage.
- Choose the version of Python you wish to install from the official webpage for its source code. Get the Gzipped source tarball URL from the Files section, which is located towards the bottom of the page:
- Obtain the most recent version of Python’s source code by using the wget command and the URL provided:
Step 4: Revise File Compression
Next, open the.tgz file you just downloaded and extract its contents. Follow these steps:
To use the downloaded file, replace the version numbers in the tgz name with them.
Step 5: System Testing and Python Optimisation
Optimise Python and run system tests before installing the package.
Once you’ve navigated to the folder where you extracted the.tgz file, type:
The procedure is time-consuming. Keep waiting till it’s done before proceeding.
Step 6: Get Python Set Up
Following the completion of optimization and testing, execute the following command to construct the Python package:
Attention: If you’re using Python 3 and would like to install Python 2 on top of it, do the following command:
Just wait for it to finish.
Step 7: The seventh step is to check the version of Python.
To verify a successful installation, run the following:
To view the installed program version, run the command.
Attention: If you are new to Python and have yet to decide on an integrated development environment (IDE) or code editor, we have compiled a detailed list of the top Python options.
Method 3: Use the Packaged Python Archive (PPA) to Set Up Python
One alternative to the official Ubuntu repositories for installing updated software is a Personal Package Archive (PPA), a third-party repository in Ubuntu.
Python can be installed via a PPA by following these steps:
Step 1: Repository Lists Must Be Regularly Updated and Revised.
The following command should be entered into a terminal window:
Step 2: Install Any Necessary Supplemental Software
The software-properties-common package allows you to have more command over your package manager by adding PPA (Personal Package Archive) repositories. Following these instructions: will install the necessary software:
Step 3: Deadsnakes PPA Addition
With more recent releases than the official Ubuntu repository, Deadsnakes is a PPA worth considering. Go ahead and execute the following to add the PPA:
Click “Enter” to proceed when prompted by the system. Refresh the package lists after the procedure is finished:
Step 4: The fourth step is to set up Python 3.
If you’re looking to Python installation an older version of Python, you can find them in the Deadsnakes PPA database. When installing a package, look for the version number in the name.
You can install Python 3.12 by running this command, for instance:
Confirm the installation with y and then wait for it to finish.
Step 5: The fifth step is to check that everything is installed correctly.
When you’re sure Python installation properly, run:
You should see the version of the program you installed in the output.
Summary about Python installation
Your Ubuntu system should have Python 3 installed and ready to go. The next thing to do is find out if you have already installed PIP for Python.
After you’ve set everything up, you can begin by learning the fundamentals, such as how to use Python’s built-in file management methods or how to get the current time and date.
As the Python installation comes to a close, it becomes clear how important it is to set a solid foundation for development to go smoothly. Following this instruction, you have successfully set up Python and prepared your environment for coding adventures. Remember that this is just the beginning of your trip; it is far from over.
You may explore limitless opportunities in web development, data science, and more with a functional Python installation. Therefore, celebrate this achievement, and may your programming endeavors thrive in the flexible world of Python.
READ MORE: How to Track Someone’s Phone