banner



How To Check If Python Is Installed On Windows

Python doesn't come prepackaged with Windows, but that doesn't mean Windows users won't detect the flexible programming language useful. It'southward not quite a simple as installing the newest version still, and so let's make sure you get the right tools for the task at manus.

First released in 1991, Python is a popular high-level programming language used for full general purpose programming. Thank you to a design philosophy that emphasizes readability it has long been a favorite of hobby coders and serious programmers alike. Non but is information technology an piece of cake language (insufficiently speaking, that is) to pick upwards merely yous'll discover thousands of projects online that require you lot accept 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 tin can make things a flake confusing to newcomers, but don't worry. We'll walk y'all through installing both major versions

When you lot visit the Python for Windows download page, you'll immediately see the partition. Correct at the pinnacle, foursquare and middle, the repository asks if you want the latest release of Python 2 or Python 3 (2.7.13 and 3.half dozen.1, respectively, equally of this tutorial).

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

Newer is better, correct? Maybe so, maybe not. The version you want depends on your stop goal. Allow's say, for example, that you read our commodity most expanding your Minecraft globe with MCDungeon and are excited to add cool stuff to your worlds. That project is coded in Python and requires Python 2.7—you lot tin't run the MCDungeon project with Python three.6. In fact, if you're exploring hobby projects like MCDungeon, you lot'll observe that virtually all of them employ 2.seven. If your goal is to get some project that ends in a ".py" extension up and running, and so there'due south a very,very skilful chance yous'll demand 2.7 for it.

On the other hand, if yous're looking to actually acquire Python, nosotros recommend installing both versions next (which y'all tin can practice with zero risk and simply a tiny bit of setup hassle). This lets you work with the newest version of the linguistic communication, but also run older Python scripts (and test backwards compatibility for newer projects). Comparison the two 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 can download but Python 2 or Python 3 if you lot're sure you lot only need a particular version. We're going the distance today and will be installing both of them, so nosotros recommend you download both versions and do the same. Under the principal entry for both versions you'll see an "x86-64" installer, as seen beneath.

RELATED: What'southward the Difference Betwixt 32-scrap and 64-bit Windows?

This installer volition install the advisable 32-flake or 64-chip version on your calculator automatically (hither's some further reading if y'all want to know more about the differences between the two).

How to Install Python two

Installing Python 2 is a snap, and dissimilar in years past, the installer will fifty-fifty set the path variable for you (something we'll be getting into a bit afterward). Download and run the installer, select "Install for all users," and then click "Next."

On the directory option screen, go out the directory as "Python27" and click "Side by side."

On the customization screen, coil down, click "Add python.exe to Path," and then select "Will be installed on local hard drive." When you're washed, click "Next."

You don't accept to make any more decisions after this point. Just click through the wizard to consummate the installation. When the installation is finished, y'all can confirm the installation by opening up Command Prompt and typing the following command:

python -Five

Success! If all you lot demand is Python ii.7 for some project or another, you tin terminate right here. It's installed, the path variable is prepare, and yous're off to the races.

How to Install Python 3

If y'all want to learn the newest version of Python, you'll need to install Python 3. You can install it alongside Python 2.7 with no problems, and then go ahead and download and run the installer at present.

On the showtime screen, enable the "Add Python 3.6 to PATH" choice and then click "Install Now."

Adjacent, you lot have a determination to make. Clicking the "Disable path length limit" option removes the limitation on the MAX_PATH variable. This change won't intermission annihilation, but will allow Python to use long path names. Since many Python programmers are working in Linux and other *nix systems where path proper noun length isn't an issue, turning this on in accelerate tin can aid smooth over any path-related bug you might have while working in Windows.

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

We recommend go ahead and selecting this choice. If you know you don't want to disable the path length limit, you tin just click "Close" to finish the installation. And, if you want to read more about the issue before committing to the change, read up here.

If yous're just installing Python iii, you can use the same command line trick of typing python -five that we used above to check 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 constitute in the following department.

Adjust System Variables So You Tin Access Both Python Versions From the Command Line

This section of the tutorial is completely optional, but will allow you lot to chop-chop access both versions of Python from the command line. Later on installing both versions of Python, you may have noticed a little quirk. Fifty-fifty though we enabled the organization path for both Python installations, typing "python" at the command prompt only points you to Python 2.vii.

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

The latter is exactly what'due south happening in this instance: the Python 2 installer edited the system wide variable and the Python iii installer added a user level variable—and we tin can ostend this by looking at the Windows' environment variables.

Hit Kickoff, type "advanced system settings," and then select the "View advanced system settings" selection. In the "System Properties" window that opens, on the "Avant-garde" tab, click the "Surround Variables" push button.

Here, y'all can run across Python three listed in the "User variables" department and Python 2 listed in the "System variables" section.

At that place are a few ways you tin remedy this state of affairs. The simplest (albeit the one with the least functionality) is to just remove the entry for the version of Python yous plan on using the least. While that'south simple, it's also not very much fun. Instead nosotros can brand another change that will requite us access to "python" for Python two and "python3" for Python 3.

To do this, fire up File Director and head to the folder where you installed Python 3 (C:\Users\[username]\AppData\Local\Programs\Python\Python36 by default). Make a re-create of the "python.exe" file, and rename that copy (not the original) to "python3.exe".

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

Boom! You can now use the "python" command at the Command Prompt when you desire to use Python 2.7 and the "python3" command when y'all want to apply Python 3.

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

If, for any reason, you don't find this a satisfactory solution, you can e'er reorder the ecology variables. Be sure to brush upwards with our tutorial first if yous're not comfortable editing those variables.

Please notation, however, that regardless of which method you use it is important to exit the original python.exe intact every bit the applications in the /scripts/ subdirectory for both versions of Python rely on that filename and will fail if it is missing.


Subsequently a little installing and a little tweaking, you take both versions installed and you're set up for whatever Python projection yous want to tackle.

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

Posted by: futrelltwithe.blogspot.com

0 Response to "How To Check If Python Is Installed On Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel