This article describes steps to install Python programming language on system running Ubuntu Linux. Python is a popular programming language.
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is meant to be an easily readable language. Its formatting is visually uncluttered and often uses English keywords where other languages use punctuation. Unlike many other languages, it does not use curly brackets to delimit blocks, and semicolons after statements are allowed but rarely used. It has fewer syntactic exceptions and special cases than C or Pascal.
Following are the steps to install Python Programming language in a Ubuntu (Debian) Linux system:
- You should first do add – apt – repository. Go to Terminal program and type the below command:
$ sudo add-apt-repository ppa:deadsnakes/ppa
- Enter your root password and you will get the installing process in display. Then it will beĀ asking you to press enter, if you want to continue to press enter.
- Then update the repository as given below:
$ sudo apt-get update
- And then, you have to install Python version. So if the current version of python is 3.11, perhaps it’s a good idea to use python 3.10 or if the current version is 3.12, use 3.11 here and so on.. So below I am installing my Python version 3.10:
$ sudo apt install python3.10
- Press on Y and then enter to continue installation. Now that you have installed Python in your Linux you can check Python version installed properly by typing following command which in my case is version 3.10 and press Enter:
$ python3.10
- Then if you see below output and see three arrows, that means Python was installed and you can write in Python:
Python 3.10.9 (main, Dec 7 2022, 01:11:56) [GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 2 + 5 7 >>>
Note: You can exit the above Python prompt by typing exit()
- So you can type in Python code after the arrows. But a better way to run python code is through PyCharm which is an open source and free IDE (Integrated Development Environment) software for writing Python code. So let’s install PyCharm and for that you need to open a new terminal window or you can continue in the already opened Terminal window by exiting the Python prompt. We will use the snap package manager to install pycharm-community. Type the command as below and press enter:
$ sudo snap install pycharm-community --classic
- Finally, you will get prompt about succesful installation as below:
pycharm-community 2022.3.1 from jetbrains* installed
So now you can check PyCharm installation by searching for PyCharm among your programs, press and enter to open it and PyCharm window should open up.
So that was how to install Python on Linux. Hope you find this installation guide helpful. Do let me know If you have issues with the installation or feedback by sending me an e-mail: naveen@techdash.in
Enjoy and happy coding in Python!