banner



How To Properly Install Python

Python doesn't come prepackaged with Windows, but that doesn't hateful Windows users won't find the flexible programming linguistic communication useful. Information technology's not quite a uncomplicated as installing the newest version even so, so let's make sure you lot get the right tools for the task at manus.

Offset released in 1991, Python is a popular high-level programming language used for full general purpose programming. Thanks to a blueprint philosophy that emphasizes readability it has long been a favorite of hobby coders and serious programmers alike. Non but is it an easy language (comparatively speaking, that is) to pick up but yous'll find thousands of projects online that require you have Python installed to use the program.

Which Version Practise You Need?

Unfortunately, there was a significant update to Python several years agone that created a big divide betwixt Python versions. This can brand things a bit disruptive to newcomers, but don't worry. We'll walk you through installing both major versions

When y'all visit the Python for Windows download page, you'll immediately see the sectionalisation. Right at the top, square and center, the repository asks if you want the latest release of Python 2 or Python 3 (two.7.thirteen and three.6.1, respectively, as of this tutorial).

RELATED: Add Dungeons, Ruins, and Treasure Hunts to Your Minecraft Globe with MCDungeon

Newer is better, correct? Peradventure so, maybe not. The version you lot want depends on your terminate goal. Let's say, for case, that you read our commodity about expanding your Minecraft globe with MCDungeon and are excited to add together cool stuff to your worlds. That projection is coded in Python and requires Python 2.vii—you lot can't run the MCDungeon project with Python 3.6. In fact, if yous're exploring hobby projects similar MCDungeon, you lot'll discover that nearly all of them use 2.7. If your goal is to get some project that ends in a ".py" extension upwards and running, so there's a very,very skilful chance you'll demand 2.vii for it.

On the other hand, if you're looking to actually learn Python, we recommend installing both versions side by side (which y'all can practise with zero take a chance and but a tiny bit of setup hassle). This lets you work with the newest version of the language, but also run older Python scripts (and test backwards compatibility for newer projects). Comparing the 2 versions is an article unto itself, though, so we'll defer to the Python project wiki where you can read their well written overview of the differences.

You lot tin download just Python 2 or Python three if yous're sure yous only need a detail version. We're going the distance today and will be installing both of them, then we recommend you download both versions and do the same. Nether the primary entry for both versions you'll encounter an "x86-64" installer, equally seen below.

RELATED: What's the Departure Betwixt 32-bit and 64-bit Windows?

This installer will install the appropriate 32-bit or 64-bit version on your computer automatically (hither'southward some further reading if you want to know more about the differences between the two).

How to Install Python ii

Installing Python two is a snap, and unlike in years by, the installer will even ready the path variable for you (something nosotros'll be getting into a chip later). Download and run the installer, select "Install for all users," and then click "Next."

On the directory selection screen, exit the directory as "Python27" and click "Adjacent."

On the customization screen, curlicue downwards, click "Add together python.exe to Path," and then select "Volition be installed on local difficult bulldoze." When you're done, click "Next."

You don't have to brand any more than decisions after this point. Just click through the wizard to complete the installation. When the installation is finished, you can confirm the installation by opening up Control Prompt and typing the following control:

python -V

Success! If all yous need is Python 2.vii for some project or some other, y'all can stop correct here. It'south installed, the path variable is set, and you're off to the races.

How to Install Python 3

If yous want to learn the newest version of Python, you'll need to install Python 3. You can install information technology aslope Python 2.seven with no problems, so go ahead and download and run the installer now.

On the first screen, enable the "Add Python 3.half dozen to PATH" option and then click "Install At present."

Side by side, you accept a decision to make. Clicking the "Disable path length limit" pick removes the limitation on the MAX_PATH variable. This modify won't break anything, but will let Python to use long path names. Since many Python programmers are working in Linux and other *aught systems where path proper noun length isn't an upshot, turning this on in accelerate can aid smoothen over whatever path-related issues you might have while working in Windows.

RELATED: How to Make Windows 10 Accept File Paths Over 260 Characters

We recommend get alee and selecting this option. If you know you don't desire to disable the path length limit, you lot can just click "Close" to finish the installation. And, if you want to read more almost the issue before committing to the change, read upwardly here.

If you're merely installing Python 3, you can use the same command line trick of typing python -v that we used above to cheque that information technology is installed correctly and the path variable is fix. If you're installing both versions, however, you need to make the quick tweak found in the following section.

Adjust Arrangement Variables So You Can Access 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. Later installing both versions of Python, you may accept noticed a petty quirk. Even though we enabled the system path for both Python installations, typing "python" at the command prompt only points yous to Python ii.7.

The reason for this is unproblematic: the variable (whether automatically adjusted by an installer or manually tweaked) simply points at a directory, and every executable in that directory becomes a command line control. If there are 2 directories listed and both have a "python.exe" file in them, whichever directory is higher in the list of variables gets used. And, if there is a variable prepare for the system and the user, the organisation path takes precedence over the user path.

The latter is exactly what's happening in this case: the Python 2 installer edited the system broad variable and the Python three installer added a user level variable—and we can ostend this by looking at the Windows' environment variables.

Hit Starting time, type "advanced organization settings," then select the "View advanced system settings" option. In the "System Properties" window that opens, on the "Advanced" tab, click the "Surround Variables" push.

Here, you tin come across Python 3 listed in the "User variables" section and Python two listed in the "System variables" section.

There are a few ways you tin remedy this state of affairs. The simplest (albeit the ane with the to the lowest degree functionality) is to just remove the entry for the version of Python you lot plan on using the least. While that's simple, it's likewise not very much fun. Instead we can make another change that will give us access to "python" for Python ii and "python3" for Python iii.

To do this, burn up File Manager and caput to the folder where y'all installed Python 3 (C:\Users\[username]\AppData\Local\Programs\Python\Python36 by default). Brand a copy of the "python.exe" file, and rename that copy (non the original) to "python3.exe".

Open a new control prompt (the environmental variables refresh with each new control prompt you open), and type "python3 –version".

Smash! You can at present use the "python" command at the Command Prompt when you want to use Python 2.vii and the "python3" command when you lot want to use Python 3.

RELATED: How to Edit Your Arrangement PATH for Easy Control Line Access in Windows

If, for whatever reason, you lot don't find this a satisfactory solution, you lot can always reorder the environmental variables. Exist sure to castor upwards with our tutorial first if you're not comfy editing those variables.

Please annotation, however, that regardless of which method yous use it is important to leave the original python.exe intact as the applications in the /scripts/ subdirectory for both versions of Python rely on that filename and will fail if information technology is missing.


After a little installing and a little tweaking, you have both versions installed and you're ready for whatsoever Python projection you want to tackle.

Source: https://www.howtogeek.com/197947/how-to-install-python-on-windows/

Posted by: mcraeopoetinat.blogspot.com

0 Response to "How To Properly Install Python"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel