How to install Python on Windows

Python does not come pre-installed with Windows, and if you want to either work with it or practice, you need to install it. Because the installation process is not that simple, let's look at all the steps you need to do.

python, install

Python was created by the Dutchman Guido van Rossum at the Centrum Wiskunde & Informatica Research Center (CWI) in 1989 and was first released in 1991.

It has since become a popular high-level programming language, used for general-purpose programming. Thanks to a design philosophy that emphasizes readability, it has long been the favorite language of developers.

Its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages ​​such as C++ or Java. It stands out because it has many libraries that make several common tasks very easy and for speed her

It has the disadvantage that because it is interpretable it is slower than compiled languages ​​such as C and C ++. For this reason it is not suitable for writing operating systems.

Not only is it an easy language (comparatively speaking), but you'll find thousands of projects online that require you to have Python installed to use the program. An example is the Cupscale that we presented to you here.

Which version do you need?
Unfortunately, there was a major update to Python several years ago that made a big difference between its versions. This can make things a little confusing for newcomers, but don't worry. We will guide you through the installation of both main versions

When you visit Python download page for Windows, you will immediately see this division. There is version 3 followed by its own updates and version 2 which still has its own updates today. So good morning you have to choose which one you want. Python 2 or Python 3 (2.7.18 and 3.9.7, respectively, in this tutorial).

python download

Younger is better, right? Maybe yes maybe no. Which version you want depends on your end goal. There are programs written in Python 2 that cannot be edited or run with Python 3. If the program you want to run ends up in “.py” to function, then there is a very good chance you will need version 2.7 for this.

On the other hand, if you really want to learn Python, we recommend that you install both versions side-by-side (which you can do with zero risk and only a small setup problem). This allows you to work with the latest version of the language, as well as run older Python scripts (and test backward compatibility for newer projects).

You can only download Python 2 or Python 3 if you are sure you only need a specific version. As we said we will tell you how to install for both. By selecting version 2 for a start you will see an "x86-64" installer. This installer will automatically install the appropriate 32-bit or 64-bit version on your computer.

How to install Python 2
Download and of the installer, select “Install for all user” and then click “Next”.

python 27 install 1

In the directory selection screen, drop the directory as “Python27” and click “Next”.

python 27 install 2

On the Adjustment screen, scroll down, click "Add Python.exe to Path", and then select "Will be installed on local hard drive." hard drive). When done, click "Next". For information on what Path is, see our related article here.

python 27 install 3

You do not need to fill in anything after this point. Just click on the wizard to complete the installation. When completed, you can confirm the installation by opening the command prompt and typing the following command:

python -V

End! If all you need is Python 2.7 for a project or whatever, you can stop here. It is installed, the path environment variable is set and you start.

How to install Python 3
If you want to know the latest version of Python, you need to install Python 3. You can install it in parallel with Python 2.7 without any problems, so go ahead and download and run the corresponding installer.

On the first screen, select the "Add Python 3.6 to PATH" option, then click "install Now".

python 3 install 1

Then you have a decision to make. Clicking "Disable path length limit" removes the MAX_PATH variable. This change will not break anything, but will allow Python to use long path names.

Because many Python developers work on Linux and other * nix systems where path length is not a problem, pre-activating it can help alleviate any path-related problems you may have while working on Windows.

We recommend that you go ahead and make this choice. If you know you do not want to disable the path length limit, you can simply click "close" to complete the installation.

If you only install Python 3, you can use the same command line trick by typing python -v above to check that it is installed correctly and that the path variable is set. However, if you are installing both versions, you need to make a small intervention in Windows, as follows.

Adjust the system variables so that you have in both Python versions from the command line
This section of the tutorial is completely optional, but will allow you to quickly access both versions of Python from the command line. After installing both versions of Python, you may notice a slight tangle. Even if you enable the system path for both Python installations, typing "python" in the command line will only take you to Python 2.7.

The reason for this is simple: the environment variable (either configured automatically by an installer or modified manually) simply points to a directory, and each executable file in that directory becomes a command line command. If there are two directories listed and both have a "python.exe" file, the directory used is higher in the list of variables. And, if there is a set of variables for the system and the user, the system path overrides the user path.

The latter is exactly what happens in this case: Python 2 installer edited the system interface variable and Python 3 installer added a user interface variable. You can confirm this by looking at Windows environment variables.

Go to Settings> System> Info. On the right, click on "Advanced System Settings". In the "System Properties" window that will open, on the "Advanced" tab, click the "Environment Variables" button.


Here, you can see Python 3 in the "User Variables" section and Python 2 in the "System Variables" section.

python variables

There are several ways to fix this situation. The simplest (though with the least functionality) is to simply remove the entry for the Python version that you intend to use less. Although this is simple, it is not very fun. Instead we can make another change that will give us access to "python" for Python 2 and "python3" for Python 3.

To do this, enable File Manager and navigate to the folder where you installed Python 3 (if you did not change it manually it is C: \ Users \ [username] \ AppData \ Local \ Programs \ Python \ Python36 by default) . Make a copy of the "python.exe" file and rename this copy (do not tamper with the original) as "python3.exe".

python rename

Open a new command prompt (environmental variables are updated with each new command prompt you open) and type “python3 –version”.

Perfect! You can now use the "python" command at the command prompt when you want to use Python 2.7 and the "python3" command when you want to use Python 3.

If, for whatever reason, you did not like this solution, you can always rearrange the environment variables, as long as you know what you are doing.

Keep in mind, however, that whatever method you use, it is important to keep the original python.exe intact, as applications in / scripts / subdirectory for both versions of Python rely on this filename and will fail if it is missing. .

After a little installation and a little modification, you have installed both versions and you are ready for any Python project you want to try. The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.081 registrants.
python, install

Written by Dimitris

Dimitris hates on Mondays .....

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).