banner



How To Install Python On Windows 10 Command Line

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

Get-go released in 1991, Python is a pop high-level programming language used for general purpose programming. Thanks to a blueprint philosophy that emphasizes readability information technology has long been a favorite of hobby coders and serious programmers alike. Not simply is it an easy language (comparatively speaking, that is) to pick upward but you'll find thousands of projects online that require yous have Python installed to apply the program.

Which Version Exercise You Demand?

Unfortunately, there was a significant update to Python several years ago that created a big dissever between Python versions. This can make things a bit confusing to newcomers, only don't worry. We'll walk you through installing both major versions

When yous visit the Python for Windows download page, you'll immediately see the sectionalization. Right at the acme, foursquare and center, the repository asks if you desire the latest release of Python ii or Python 3 (2.seven.13 and three.six.1, respectively, every bit of this tutorial).

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

Newer is better, right? Mayhap then, maybe not. The version you want depends on your end goal. Let's say, for example, that yous read our commodity about expanding your Minecraft world with MCDungeon and are excited to add cool stuff to your worlds. That project is coded in Python and requires Python ii.7—you can't run the MCDungeon project with Python 3.6. In fact, if yous're exploring hobby projects like MCDungeon, you'll find that about all of them utilise 2.7. If your goal is to get some project that ends in a ".py" extension upwardly and running, then in that location's a very,very good chance you'll need 2.7 for it.

On the other hand, if yous're looking to actually learn Python, we recommend installing both versions side past side (which you can do with zero risk and only 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 commodity unto itself, though, and so we'll defer to the Python project wiki where yous can read their well written overview of the differences.

Y'all can download but Python 2 or Python iii if you lot're certain you just need a particular version. We're going the distance today and will exist installing both of them, then we recommend yous download both versions and practise the same. Under the main entry for both versions you'll see an "x86-64" installer, as seen below.

RELATED: What's the Deviation Between 32-bit and 64-bit Windows?

This installer will install the appropriate 32-bit or 64-bit version on your reckoner automatically (here'due south some further reading if you desire to know more about the differences between the two).

How to Install Python 2

Installing Python two is a snap, and different in years past, the installer volition even set up the path variable for you (something we'll exist getting into a flake later). Download and run the installer, select "Install for all users," and then click "Next."

On the directory choice screen, go out the directory as "Python27" and click "Adjacent."

On the customization screen, scroll downwards, click "Add python.exe to Path," so select "Will be installed on local hard drive." When y'all're done, click "Adjacent."

You don't have to brand any more than decisions later this indicate. Merely click through the magician to consummate the installation. When the installation is finished, yous can confirm the installation by opening upward Command Prompt and typing the following command:

python -V

Success! If all you need is Python two.7 for some projection or another, yous can cease right here. It's installed, the path variable is prepare, and you're off to the races.

How to Install Python 3

If you desire to learn the newest version of Python, you'll need to install Python 3. Yous can install information technology aslope Python ii.7 with no issues, and then go ahead and download and run the installer now.

On the starting time screen, enable the "Add Python 3.6 to PATH" option and so click "Install Now."

Next, you accept a decision to make. Clicking the "Disable path length limit" pick removes the limitation on the MAX_PATH variable. This change won't break anything, but will let Python to use long path names. Since many Python programmers are working in Linux and other *cypher systems where path name length isn't an issue, turning this on in accelerate can help shine over whatever path-related issues y'all might have while working in Windows.

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

We recommend go ahead and selecting this option. If yous know you don't want to disable the path length limit, yous can simply click "Shut" to terminate the installation. And, if yous want to read more nearly the issue before committing to the change, read upwardly hither.

If you're just installing Python iii, yous can utilise the aforementioned command line trick of typing python -v that we used above to check that it is installed correctly and the path variable is set. If you lot're installing both versions, however, you lot need to brand the quick tweak found in the following section.

Conform System Variables And then You Tin Access Both Python Versions From the Command Line

This department of the tutorial is completely optional, just will let yous to quickly access both versions of Python from the control line. After installing both versions of Python, you may have noticed a little quirk. Even though we enabled the arrangement path for both Python installations, typing "python" at the command prompt only points you to Python ii.7.

The reason for this is simple: 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 at that place are two directories listed and both have a "python.exe" file in them, whichever directory is college in the list of variables gets used. And, if there is a variable gear up for the system and the user, the system path takes precedence over the user path.

The latter is exactly what's happening in this example: the Python two installer edited the system wide variable and the Python 3 installer added a user level variable—and we tin ostend this by looking at the Windows' environment variables.

Hit Start, blazon "advanced system settings," and so select the "View advanced system settings" choice. In the "Arrangement Properties" window that opens, on the "Advanced" tab, click the "Surround Variables" button.

Hither, you can see Python 3 listed in the "User variables" section and Python two listed in the "System variables" department.

There are a few ways y'all tin remedy this situation. The simplest (albeit the one with the least functionality) is to just remove the entry for the version of Python yous programme on using the to the lowest degree. While that's simple, it'due south too not very much fun. Instead we can brand another modify that will give us admission to "python" for Python 2 and "python3" for Python three.

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

Open up a new command prompt (the ecology variables refresh with each new command prompt yous open), and type "python3 –version".

Boom! You tin at present use the "python" control at the Control Prompt when you lot want to use Python 2.7 and the "python3" command when you want to use Python 3.

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

If, for whatsoever reason, you don't find this a satisfactory solution, you can always reorder the environmental variables. Be certain to brush up with our tutorial start if you're not comfortable editing those variables.

Please note, however, that regardless of which method you use information technology is important to go out 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.


Afterwards a picayune installing and a footling tweaking, y'all have both versions installed and you're ready for any Python project you lot want to tackle.

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

Posted by: malonesulde1977.blogspot.com

0 Response to "How To Install Python On Windows 10 Command Line"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel