How to Get Python in Linux
Ads by Google
Python is considered the a easy to learn language due to its simpler syntax and abundance of libraries and frameworks that allow for rapid development. It is an interpreted general programming language and most new coders are learning to code using python.
We can do python programming using Linux, most of the Linux distributions come with the python interpreter pre-installed but it won’t be the latest version. In this article we are going to learn how to get python installed on some well-known Linux distributions.
Ubuntu
Ubuntu is one of the most famous Linux distributions. The recent versions of Ubuntu come with Python 3.6 pre-installed. You can check your Ubuntu version by using the following command:
Ubuntu 17.10, Ubuntu 18.04(and above): come with Python 3.6 pre-installed by default.
You can access the python interpreter by the following command:
Ubuntu 16.10 and Ubuntu 17.04: These versions of Ubuntu do not come with python 3.6 pre-installed. But it can be installed using the universe repository by using the following commands:
Ubuntu 14.04 and Ubuntu 16.04: These versions of ubuntu don’t have Python3.6 in the Universe library. We can get using a Personal Package Archive (PPA).
We can use the “deadsnakes PPA” and install it using the following commands:
Linux Mint
Linux mint and Ubuntu have the same package management system. We can use the same commands to install Python:
CentOS
To install linux we first need to update the yum package manager:
We then need the IUS package to get the latest version of python:
Now we can get python installed on our system:
Fedora
Fedora’s current version and a few future versions will ship with Python2 as default. If we don’t have python3 installed on your system we can do so by using the following command:
Arch Linux
Arch Linux makes sure that you have the latest python version and its likely that you already have the latest version, however you can use the following command to get the latest version:
As of writing the latest version of Python is 3.7.4, you can get it by replacing the 3.6 with 3.7
Python is one of the fastest growing languages, so it’s best to have the latest version with the latest libraries.
Can I use Python on Linux?
How do I get Python 3 on Linux?
- $ python3 –version.
- $ sudo apt-get update $ sudo apt-get install python3.6.
- $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.8.
- $ sudo dnf install python3.
How do I upgrade to Python 3.7 Linux?
- Step 0: Check the current python version. Run below command to test the current version installed of python.
- Step 1: Install python3.7. Install python by typing:
- Step 2: Add python 3.6 & python 3.7 to update-alternatives.
- Step 3: Update python 3 to point to python 3.7.
- Step 4: Test the new version of python3.
Which is latest version of Python?
How do I make Python 3 default in Linux?
- Check python version on terminal – python –version.
- Get root user privileges. On terminal type – sudo su.
- Write down the root user password.
- Execute this command to switch to python 3.6.
- Check python version – python –version.
- All Done!
How do I know if Python is installed on Linux?
- Check the Python version on the command line: —version , -V , -VV.
- Check the Python version in the script: sys , platform. Various information strings including version number: sys.version. Tuple of version numbers: sys.version_info.
How do I run python from command line?
To run Python scripts with the python command, you need to open a command-line and type in the word python , or python3 if you have both versions, followed by the path to your script, just like this: $ python3 hello.py Hello World!
Why is Python not recognized in CMD?
What is the version of Python?
Version | Release Date |
---|---|
Python 3.6 | December 2016 |
Python 3.6.5 | March 2018 |
Python 3.7.0 | May 2018 |
Python 3.8 | October 2019 |
Is C++ better than Python?
Which Python version is best?
Can I learn python on my own?
Is Python for free?
Ads by Google