This weekend, I needed to set up Python on a Windows 7 virtual machine that I had set up on my Mac. I don’t know why, but I always seem to have a problem installing Python and setting up the environment and so I’m going to document the process here so that in X months time when I need to do it again, I just need to follow my own instructions!
As part of the process, I also install easy_install to install libraries and so I’ll also document that here.
1. Download the Python Windows installer from here -> http://www.python.org/download/ (I downloaded Python 2.7.5) and run the executable on your machine.
2. Run the installer – I normally leave all the defaults as they are, so end up installing it in C:\Python27
3. Once installed, SET UP YOUR ENVIRONMENT VARIABLES, I can not express how important this is as you’ll hit so many problems without do it (try opening the command prompt and typing python to see Windows shrug its shoulders and say “huh…dunno…”)
- If you haven’t played with environment variables before, just stick to following these instructions as you can set them up through the Windows GUI.
- Right click on “My Computer”, select “Properties” > “Advanced system settings” and click on the “Environment Variables” button
- In the System Variables box, find the variable called “path” and click on the “Edit…” button
- In the “Variable value” box, at the end of the entry, add the following text: ;C:\Python27;C:\Python27\Scripts (note the leading semi colon, also note that I’m using the default installation folder – if you have installed Python elsewhere, just change the path structure).
- Click “OK” a couple of times and hey presto, your environment variables are set up.
- To test it has worked, open a new command window and type in
pythonand if you see this, you’re on to a winner…
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
4. The next step in the process is to set up easy_install and so we need to go to the setuptools page (links to version 0.8) and download the ez_setup.py script (I normally put it straight in to my Python27 folder).
5. Open a command prompt and type
python ez_setup.py install – you’ll see a load of code whizz by which will hopefully end as follows;
Processing dependencies for setuptools==0.8
Finished processing dependencies for setuptools==0.8
6. easy_install has now been set up and you can test to see if it is there, by typing
easy_install in to a command prompt, which will throw an error about no URLs, you know that the tool has been set up successfully
To use easy_install to get new libraries, just use the following syntax:
easy_install <library name> (e.g.
[…] Setting up Python and Easy_Install on Windows 7 (adesquared.wordpress.com) […]
I got stucked in step number 5.
When I open the command prompt and type “python ez_setup.py install” then an error message is displayed “syntax error”
I do not know why is this happening and how to solve it. Any help?
I also tried to run the ez_setup.py script and I get the following:
Extracting in c:\users\alice\appdata\local\temp\tmpqhiqcp
Now working in c:\users\alice\appdata\local\temp\tmpqhiqcp\setuptools-0.8
Something went wrong during the installation.
See the error message above.
Something is not working properly. Do you have any idea what could it be?
Any help on the subject will be very much appreciated
Thank you !!
It looks like it extracted it successfully in to c:\users\alice\appdata\local\temp\tmpqhiqcp\setuptools-0.8 and so I would use the command prompt to go in to that location and try running “python ez_setup.py install” again from within there – that should work.
Another thing to check is what version of Windows you are using (32 or 64 bit) and make sure you’ve downloaded and installed the correct version of setuptools.
I hope that helps and good luck!
Really helpful. Thank you so much!
Many thanx for providing excellent documentation. Identifying each stop clearly is very helpful. You don’t assume the reader knows where to ez_setup file or other small details that an derail the novice reader.
[…] https://adesquared.wordpress.com/2013/07/07/setting-up-python-and-easy_install-on-windows-7/ […]
You are great!!!!
This is the easiest most clear and helpful instructions to install python and other packages that I have come across on the web. Thanks a lot.
Thank you !
I can’t run easy install, when I run it I get the following error:
‘easy_install’ is not recognized as an internal or external command,
operable program or batch file.
Take a look at this post on StackOverflow – just make sure your environment variables have been set up and you should be good to go.
I am just going through the install. In my case add pythone.exe to path option was not selected.
Hi, Thanks you very much. Really helpful.
It’s been a while since this post was published, but I guess people will still come to this page.
For future reference, I want to add this:
I got stuck in step 5, too, just as reported by Mauricio in the comments.
So, I did this trick: Go to your c:\python27 directory. A zip file named supertools-7.zip must be there. Just open it and directly run the setup.py file. It worked for me and installed.
Another issue: Even though I added the c:\python27\scripts in the PATH, it still did not run. So just try changing directory and running the name of the script. *for me, it was easy_install-script. py
Many thanks for your comment – think it’s time I updated this post! It regularly gets a lot of traffic and is for an earlier version of Python so probably doesn’t match current installation requirements. Thanks for flagging it up and I’ll start working on an update!
[…] via Setting up Python and Easy_Install on Windows 7. […]
Thanks this was very helpful
Thank you so much for this post. I was going around in circles trying to figure out how to install Python modules under Windows until I read this. Once I fixed my Path, everything ran great. You saved me a lot of time!
[…] you’re a Windows user (like me) you won’t have a good time, but using easy_install makes life way easier! This tutorial might also be helpful for windows users. If you’re on a […]
Oh thanks. Finally a simple and straigh forward way
Thank you so much, this was so helpful
Very helpful, thank you ;).
Just what I needed!
Thank you so much ..!
So good tutorial!!!
Thank you so much
Oh yes, thanks!
Thanks Brother! You saved my day….
I realize it’s been a few years since you posted it, but thanks for putting this out there, Adele. Super helpful.