Getting a Python dev environment setup on Windows

I’ll be doing a fair amount of work in Python in the next few months, so I decided to sit down and get a good dev environment going. First on my laptop (32 bit is easier to deal with), then on my desktop.

So I’ll be doing 3 things:

  1. Getting Git setup
  2. Getting Git working with GitHub
  3. Getting Python and pip installed

First of all, started off with Git. Downloaded from, and installed it following GitHub’s Windows setup guide. (As a side note, I’m not dealing with GitHub’s native app because when I last used it, you couldn’t select individual blocks of code to be committed. I know Git philosophy is to commit often, but I just commit when I’ve got something working, and I’d have touched a few different files and done more than one thing.)

They’ve improved the installer since I last used it, so it was deceptively simple. No more messing around with config files, whee!

Second thing was integration with Github. SSH keys allow password-less authentication (I hate InteliJ’s Github integration because it uses the HTTPS repo, which requires me to enter my github password). Once again, easiest thing to do was to follow Github’s guide on generating ssh keys. Another side note: It’s ssh -T [email protected]. I was trying ssh -T and was wondering why it was failing. =|

And onto the third and final thing, which is also the most difficult: Getting Python up and running with pip installed & working. I’ll split this into two parts: getting Python, and getting pip working.

Getting Python is trivial – I downloaded it from I chose 2.7.3, but could have gone with 3.2.3. (In fact, probably should have, but modules are still coded to 2.7 compatibility, so that’s what I’ll use.)

Getting pip on is a bit more complicated – you have to install easy_install, then use that to install pip. So, I used the lovely directions at StackOverflow for inspiration:

  1. Grab setuptools from – make sure the version you get matches the version of Python installed – in my case, 2.7
  2. Install setuptools. You can follow the defaults, just make sure you install to the correct directory – where you installed Python. This should be auto-detected though.
  3. Open Powershell (I’m running Win 7; if you aren’t, you should be. And if you can’t run W7, open up command prompt instead.)
  4. In the shell, change to the directory where you installed Python, and then to the Scripts directory in that folder – ie. cd C:\Python27\Scripts
  5. Type ./easy_install pip – this works because setuptools added an executable called easy_install.exe to the Scripts/ folder
  6. Pip is now installed. If you want to install something with Pip (i.e. ), open up Powershell again if it’s not already open, change to that directory, and run ./pip install requests

For bonus points, and to get Python to run without having to prepend the directory where Python is installed to every command you run with Python, append the Python directory to your environment PATH variable.

How do you do this? On Win 7, type “Path” into the search bar in the start menu. It should get you something like this:

Select the “Edit system environment variables” option. Not the one with “Your account”.

That will take you to this screen. See the button close to the bottom labeled “Environment Variables”? That’s the one you want to click. And when you do that, you’ll get this:

I’ve skipped a bit, but you want to scroll though the box on the bottom to find the Path variable. When you’ve found it, either double click on it, and single click to select it, and press Edit.

When the screen comes up, hit “End” on your keyboard to jump to the end of the line, then add a semi-colon (which is the ; symbol, if you don’t know), and paste the directory where you installed Python. Or type it. Copy & Pasting directly from an Explorer window is less error prone, so that’s what I do.

Because it’s a system variable, it’ll only take global effect when you restart your computer. If you just want to use Python in Powershell though, just open a new Powershell instance. You can verify that Python’s present in your Path by typing $env:Path and looking at the end of the line that gets printed.


, , ,

  1. #1 by Jacob Silverman on October 8, 2016 - 3:41 pm

    This helped me so much. One change I made in following the directions was to omit “./” from Step 5 of installing “pip” so the command I used was “easy_install pip”. (Win v 8.1, Python v 3.4.2)

(will not be published)