Skip to content

Installing Python and pip

Jan Tungli edited this page Oct 11, 2020 · 5 revisions

This is mostly a copy of the wiki page of from BurntSushi's nfldb repository wiki page.

Python install

Installation of Python itself should be fairly straight-forward.

  • Download and execute the latest Python 2.* installation package from here.
  • Make sure to choose to install Pip among other things and also to select the option to add Python to PATH, i.e. make it executable from any directory.
  • Verify a successful installation by opening a command prompt window (type cmd in the Windows start bar) and navigating to your Python installation directory (default is C:\Python27). Type python from this location to launch the Python interpreter.
    Microsoft Windows [Version 6.2.9200]
    (c) 2012 Microsoft Corporation. All rights reserved.
    
    C:\Users\Username>cd C:\Python27
    
    C:\Python27>python
    Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win
    32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    

If you forgot to select making Python executable during installation, you will (probably) have to do the following:

  • It would be nice to be able to run Python from any location without having to constantly reference the full installation path name. This can by done by adding the Python installation path to Windows' PATH ENVIRONMENT VARIABLE
    *In Windows 7 and Windows 8, simply searching for "environment variables" will present the option to Edit the system environment variables. This will open the System Properties / Advanced tab
  • BE CAREFUL WHEN EDITING ENVIRONMENT VARIABLES!

In Windows XP, right click on My Computer->Properties to open System Properties and click on the Advanced tab.

  1. On the System Properties / Advanced tab, click Environment Variables to open User Variables and System Variables
  2. Create a new System Variable named Variable name: PYTHON_HOME and Variable value: c:\Python27 (or whatever your installation path was)
  3. Find the system variable called Path and click Edit

  1. Add the following text to the end of the Variable value: ;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\

  1. Verify a successful environment variable update by opening a new command prompt window (important!) and typing python from any location
    Microsoft Windows [Version 6.2.9200]
    (c) 2012 Microsoft Corporation. All rights reserved.
    
    C:\Users\Username>python
    Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win
    32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    

pip install

The easiest way to install Python packages and keep them up-to-date is with a Python-based package manager called pip

You should already have pip installed from the Python installation. Otherwise you will have to download it, install adn probably add to PATH as well.

After installing pip you can open the command prompt and do:

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Username>pip install numpy scipy matplotlib jupyter

to install the basic packages (NumPy, SciPy, Matplotlib -- for plots, Jupyter -- for notebooks)

Clone this wiki locally