How to set up Python ?

In for us to develop applications with Python, we need to have the Python interpreter installed in our system. Depending on the operating system you are using, you must install the Python interpreter on your system. I wrote in our previous article that there are two versions of Python, which will be the last and stable version that continues to be supported, which is important to us.

Installation instructions vary depending on the operating system you are using. Let’s start with GNU/Linux systems.


How to check python on GNU/Linux systems?

On GNU/Linux systems, a lot of applications running on the operating system will probably come with python installed on your system because it is written with python. However, rather than whether the python is installed or not, the version of python running on the system is more important to us. To find out, open the console in the linux distribution that you are using and type the following code:

python -V

In return, you can get the version number of the python installed on the system.

If you do not get any output after writing this code, run the code again by specifying the python version number.

python2 -V 

python3 -V

You can see the full version of the python installed on the system in response to the version number you typed. If you specified the version number but still no results, python is not installed on your system.

On Linux systems, python 2 will surely come installed. If python3 does not come out, you can install it with the package manager on your system or by coming the source code. I’m going to talk about it in a minute.

With these codes we wrote, we only learned the python’s version number. To see more details, you can run and check the following code:

ls -g {,/usr{,/local}}/bin | grep python

With this code, you can see all versions of pythons installed on the system, see when and in which root directory they are in.

How to install GNU/Linux python ?

Many different methods can be used to install an application on Linux systems. First, you can search through the package manager programs on the linux distribution that you are using to search for the python version of the distribution that you are currently using in the software store, if an appropriate version of python is installed in the stores, which you can download and install. It will perform setup automatically with all dependencies.
Installation of python3 via Linux mint package software

Another option is that if you type the following code, you can set up with dependencies: (the code structure may vary depending on the deployment you are using)

sudo apt-get install python3

If you want to install an older python version and not the python version in the reposi stores, you can compile and set up the source code as another alternative. To do this, go to the python site and download the source code based on the linux distribution you are using. After you perform the download, you can perform the setup by coming the source code. This process is a little more difficult and complicated, so it will be easier for you to set up using the methods I described up there. If you don’t know about source compilation and installation, you can learn how to do it with a short search on the Internet. But if you haven’t done this kind of compilation before, it might be difficult for you.

How to install pythons on Windows systems ?

It does not come with python installed on Windows operating systems. Therefore, you need to go to the python’s site and download the required .exe file and perform the installation.

When you go to the site, you will see the download link required to download the link with the som version. Use this download link to download the python’s installation file and start setting up.

There is only one thing to note during setup, which is to select “Add Python {version number} to PATH”. If you mark this when you set it up, you can reach the python shell and start the python by typing “python” at the command line.

You skipped this step or forgot to mark it, no problem. If you search google, such as adding windows path or adding python to windows path, you can access a lot of resources.

Leave a Reply

Your email address will not be published. Required fields are marked *