How To Setup Python On Ubuntu 18.04

by | Feb 26, 2023 | Uncategorized

A high-level, all-purpose computer language is Python. Code readability is prioritised in its design ideology, which makes heavy use of indentation. It is not specific to any one type of issue and can be used to create a broad range of programmes. It is one of the most popular computer languages today because of its adaptability and beginner-friendliness. You will learn how to set up a programming environment and install Python on Ubuntu 18.04 in this tutorial.

Requirements

  • Ubuntu 18.04 is Operating on a 99RDP Private/Dedicated Server
  • Entry To The Station

Updated and repository added

First, SSH your 99RDP server and upgrade the system’s local software packages and default repository database. This will stop Python installation errors from occurring.


# apt-get update

# apt-get upgrade


We will add the package repository for “software-properties-common” after the upgrade is complete. You can handle your distribution sources and independent software vendor sources with ease thanks to it. Run the provided command in the terminal to join the repository.


# apt install software-properties-common


The “Deadsnake” package source can also be added. Compared to the Ubuntu default package archive, this repository offers more recent programme releases.


# add-apt-repository ppa:deadsnakes/ppa


Python Setup Instructions

Now visit the official Python website and look up the most recent Linux stable version. We’re going to use version 3.11 for the instruction. To obtain and install the Python build, run the provided command.


# apt install python3.11


Once the installation is complete, use the symlink command to create a shortcut to the Python folder.


# ln -s /usr/bin/python3.11 /usr/bin/python


Finally, execute the provided command to ensure that the interpreter is operational.


# python –version

The loaded version of Python will be returned in the output.

Using pip To Manage Python Components

The pip tool will now be installed, making it easier for us to acquire and set up different Python modules. Install pip by typing the provided instructions in the terminal.


# apt install python-pip


Verify the pip version after the download is finished by executing the provided command.


# pip -V


Executing Your First Hello.py Program On Ubuntu 18.04

Your Python installation is now set to compile codes once all of this is finished. So let’s execute a simple print command from hello.py. Use any editor to enter the provided content in a file, then save it as hello.py.

print(“Hello 99RDP”)

Simply enter python filename.py in the terminal to execute the file, then wait for the results.


# python hello.py


Conclusion

This tutorial showed us how to set up Python’s most recent version on Ubuntu 18.04. Additionally, we discovered how to set up pip and execute a python file. Now that Python 3.11 is installed and functional, you can begin creating Python applications. Please get in touch with us if you have any inquiries or recommendations.

Read Our Next Articles Installing Apache HTTP Server in Ubuntu 18.04