How to install Python on Windows

Η προγραμματισμού Python δεν έρχεται προεγκατεστημένη με τα Windows, και αν θέλετε είτε να δουλέψετε μαζί της είτε να εξασκηθείτε, θα πρέπει την εγκαταστήστε. Επειδή η διαδικασία εγκατάστασης δεν είναι και τόσο απλή εργασία, ας δούμε όλα τα βήματα που πρέπει να κάνετε.

python, install

Story
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 due to the fact that it has many libraries that make several common tasks especially easy for the learning it.

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 will find thousands of projects on the internet that require you to have Python installed to use the program. An example is the free Cupscale program 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

The newest is better, right? Maybe yes maybe no. The version you want depends on your ultimate goal. There are programs written in Python 2 that can not be edited or run in Python 3. If the program you want to run ends in a ".py" extension for operation, then there is a 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 download only Python 2 or Python 3 if you are sure you only need a specific version. As we said, we will tell you the installation method for both. By selecting version 2 to begin with you will see an “x86-64” installer. This installer will automatically install the appropriate version or 64-bit on your computer.

How to install Python 2
Download and run 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 learn the latest version of Python, you should install Python 3. You can install it alongside Python 2.7 without , so go ahead and download and run the respective 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.

Customize system variables to access both versions of Python 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 set automatically by an installer, or modified manually) simply points to a directory and each executable a command line command is executed in this directory. If there are two directories listed and both have a “python.exe” file, the directory higher in the list of variables is used. And, if there is a set of system and user variables, 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.

variables

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.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.100 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.).