Python, Django, & MySQL on Windows 7, Part 1: Installing Python, Pip, and iPython

When starting my current job, I was new to Linux, Python, Django, MySQL, and pretty much every other technology the organization uses.  Furthermore, as the office’s only Windows 7 person, I was on my own when setting up a development environment.

I found several helpful tutorials but ended up creating more detailed instructions to reflect my level of experience and our project structure. These notes became my dummies guide to setting up Python, Django, and MySQL on Windows 7.

Install Python

  1. Install Python (I used the Python 2.7.2 Windows Installer).
  2. Modify your path environment variable to include the location of the installed Python executable.  To change environment variables in Windows 7:
    • Click the Windows start button in the lower-left corner of the screen.
    • In the Search programs and files box, type environment variables
    • When the search results appear, click Edit the system environment variablesedit environment variables
    • You should now see the System Properties window.  Click Environment Variables…environment variables
    • When the Environment Variables window opens, choose Path from the System variables list and click Edit…
    • Append the following location of the Python executable and the Python Scripts folder to the variable value, making sure everything is separated by a semicolon. For example, ;C:\Python27;C:\Python27\Scripts
    • Click OK after modifying the variable value, and click OK again to exit the Environment Variables dialog.
  3. You should now be able to bring up an interactive Python shell by opening a command window and typing python.
    welcome to python

Get a package installation and management tool

Many kind people have written functionality-enhancing Python Packages, and sooner rather than later you’ll need to use some of them. Life will be much easier if you have a tool to install and manage these packages.

Two such tools are pip and easy_install (part of setuptools).  Despite some disadvantages on Windows, I chose pip after reading this StackOverflow thread.

Unfortunately, pip doesn’t have a Windows installer. The easiest workaround is to install setuptools (which does have a Windows installer) and then use it to install pip.  Directions below are a modified version of yet another StackOverflow thread.

  1. Download the setuptools MS Windows installer that corresponds to your installed version of Python. If you’re on a 64-bit version of Windows 7, use this instead (thanks to commenter JukkaN for that tip).
  2. Run the setuptools install wizard.  It should automatically find your Python installation directory.
    setuptools install
  3. Make sure you have a way to extract .tar files (e.g.7-Zip).
  4. Download pip.
  5. Uncompress the pip download
  6. Open a Windows command prompt and cd to the directory that contains the uncompressed pip download (the folder structure looks something like pip-1.1). Make sure it’s the directory that contains a file called
  7. From that directory, type python install
  8. After this script runs, you should see a confirmation message that pip was installed to the site-packages folder of your python install (this folder will house all of the Python packages you install).
  9. If you get an error message, it’s probably because you haven’t added your Python directory to your path (see I above).

Install iPython

You don’t know it yet, but you need iPython.  It’s a richer version Python’s out-of-the-box interactive shell and has some extremely helpful features for people learning the language (object introspection, macros, code completion). iPython is easy to install now that you have a package management tool.

Even though I just had you install pip for this very scenario, it’s not the best choice for installing iPython on Windows. I promise pip will come in handy later, but to install iPython, use setuptools (setuptools will automatically install a module required for iPython’s code completion functionality, but pip will not).

  1. Open a windows command prompt.
  2. Type easy_install ipython
  3. iPython should now download and install.  If you get an error message, make sure your path environment variable contains the Python \Scripts folder.
    ipython install
  4. To use the iPython interactive shell, type ipython from a command window and peruse the built-in documentation.

The next part of Python, Django, & MySQL on Windows 7 will walk you through virtual environments.

, , , ,

16 Responses to Python, Django, & MySQL on Windows 7, Part 1: Installing Python, Pip, and iPython

  1. Max Claus Nunes January 11, 2013 at 10:28 am #

    Great tutorial!! Thanks.

  2. LoveTheInternet October 5, 2013 at 10:43 am #

    There’s not a lot of comments on here but there SHOULD be. I’ll speak for everyone visiting when I say THANK YOU. Really, as someone just trying to get into Python, these tutorials have the necessary detail to get me where I need to be to actually start learning and using the language instead of battling issues in set up.

  3. rise August 23, 2014 at 11:24 pm #

    Many, many thanks!!! I was able to go through your entire tutorial and install everything! Quick question though: I used Python 2.7 for this tutorial. Could you point me in the correct direction on how to also use Python 3.4? I would like to be able to choose which Python version to use for an isolated virtual environment. I’m currently able to access my Python 3.4 at the command prompt with >python3 as Python 3.4 is on the PATH.

    Thanks well in advance. Cheers.

  4. mythalar October 30, 2014 at 10:07 am #


    i am ery eager to learn python .

    i don’t quite get the instruction as instructed by commenter JukkaN.

    can you kindly guide through it?

    thanks a lot in advance.


  5. julio celso hernandez November 30, 2014 at 4:52 pm #

    It is the best tutorial that found to be installed on Windows. Almost to the detailed background and i say almost, because they lack a little more depth for us rookies that although we know about computer programming, yet somehow we are some hamper things when they are new things. Greetings from Mexico
    Es el mejor tutorial que encontrado para instalrse sobre windows. Lo detallas casi a fondo y digo casi, porque falta un poco más de profundidad para nosotros los novatos que aunque conocemos sobre programación de computadoras, aún así se nos dificultan ciertas cosas cuando son cosas nuevas.

    Saludos desde México

  6. prasad December 29, 2014 at 6:09 am #

    Thank u very much..

  7. Audi A7 January 5, 2017 at 12:55 pm #

    Hello, after reading this awesome piece of writing i am too delighted to share my experience
    here with friends.


  1. Python, Django, & MySQL on Windows 7, Part 2: Virtual Environments | Computers are for People - August 28, 2011

    […] Part 1: installing Python, pip, and iPython […]

  2. Python, Django, & MySQL on Windows 7, Part 3: iPython & Virtual Environments | Computers are for People - August 28, 2011

    […] Part 1: installing Python, pip, and iPython […]

  3. Python, Django, & MySQL on Windows 7, Part 5: Installing MySQL | Computers are for People - September 14, 2011

    […] Part 1: getting started […]

  4. Python, Django, & MySQL on Windows 7, Part 4: Installing Django | Computers are for People - September 14, 2011

    […] Part 1: getting started […]

  5. Python, Django, and MySQL on Windows 7 | Computers are for People - September 14, 2011

    […] Part 1: installing Python, Pip, and iPython […]

  6. IPython, IPython Notebook, Anaconda, and R (rpy2) | Computers are for People - August 29, 2014

    […] is to demo everything using the Anaconda Python installation. Overkill maybe, since even on Windows installing Python and IPython isn’t too terrible. That […]

  7. » Python:django import error – No module named - August 29, 2015

    […]… […]

  8. » Python:Django – “no module named” - September 10, 2015

    […]… […]

  9. Install Python and Django with Xampp on Windows 7 | Jack Vo space - June 3, 2016

    […] Python, Django, & MySQL on Windows 7, Part 1: Installing Python, Pip, and iPython […]

Leave a Reply