Thursday, 13 September 2018

How to install Python on Windows?

How to install the latest version of Python?

  • Go to Python Releases for Windows page and click the link for the latest release, e.g. Latest Python 3 Release - Python 3.7.0
  • Scroll to the bottom of the page and click on the link of the installer to download it. I opted for "Windows x86-64 web-based installer".
  • Run the installer. On the first page of the installer opt for adding Python to PATH.
  • Python will be installed in C:\Users\User\AppData\Local\Programs\Python\Python37.

If you haven't opted for adding Python to PATH during installation, you open a Terminal and try to run Python interpreter by typing python you'll get:

>python
'python' is not recognized as an internal or external command,
operable program or batch file.

To resolve this and make python binary visible from every directory add its path to Path environment variable. After that, python interpreter is visible from anywhere (in a new Terminal session):

>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>


How to install multiple versions of Python on the same system?


Sometimes you need to have on your machine installed various versions of Python e.g. some applications might require Python 2 and some Python 3. I already installed Python 3 above and now I'm gonna install Python 2:
  • Go to Python Releases for Windows page and click the link for the latest release, e.g. Latest Python 2 Release - Python 2.7.15
  • Scroll to the bottom of the page and click on the link of the installer to download it. I opted for "Windows x86-64 MSI installer".
  • Run the installer. On the first page of the installer you can opt for adding Python 2 to PATH.
  • Python will be installed in C:\Python27.
If you opt for adding Python 2 to Path, restart the Terminal (so it can pick up the latest values of environment variables) and type python, Terminal will pick Python 2:

>python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Python 2 installer has added C:\Python27 (and C:\Python27\Scripts) as first entries in PATH variable so Terminal now picks python.exe from this directory.

To make sure you are using desired version of Python interpreter in Terminal the best is to remove all Python paths from PATH and then set path to desired Python version for the current Terminal session (temporarily) by executing:

>set PATH=path\to\desired\python;%PATH%

1 comment:

micheal pan said...

BE SMART AND BECOME RICH IN LESS THAN 3DAYS....It all depends on how fast 
you can be to get the new PROGRAMMED blank ATM card that is capable of
hacking into any ATM machine,anywhere in the world. I got to know about 
this BLANK ATM CARD when I was searching for job online about a month 
ago..It has really changed my life for good and now I can say I'm rich and 
I can never be poor again. The least money I get in a day with it is about 
$50,000.(fifty thousand USD) Every now and then I keeping pumping money 
into my account. Though is illegal,there is no risk of being caught 
,because it has been programmed in such a way that it is not traceable,it 
also has a technique that makes it impossible for the CCTVs to detect 
you..For details on how to get yours today, email the hackers on : (
atmmachinehackers1@gmail.com ). Tell your 
loved once too, and start to live large. That's the simple testimony of how 
my life changed for good...Love you all ...the email address again is ;
atmmachinehackers1@gmail.com