So I’ve got a new project I’ve been working on and I wanted to port it from .NET to an open source platform. PHP has felt pretty stale to me for a while now so I figured it’s about time to learn a new language.

As any good Redditor would I thought Python would be a good choice! After some digging around trying to figure out what strategy would be best I settled on Pylons as my web framework.

Installing Pylons took a bit of time to figure out on Windows — most of the instructions I found included downloading eggs manually from the web and were targeted at Linux users. With this approach I ran in to lots version issues. I hope this guide will help make installing Pylons on Windows a little simpler for some people!

One of the things that I’m loving about Python so far is the tooling.” They” make it super easy to get eggs so you can get your environment up and running really quickly!

First thing’s First: Get Python

You’ll need to download Python, obviously. I downloaded Python 2.6.5. I’m not sure if Pylons is compatible with the 3.* branch yet. I’ll look that up and update this.

I installed Python to C:\Python26\. On another machine I tried to install to my Program Files directory like every other app but that actually failed for some reason. I would recommend you install to C:\Python26 (or obviously if your version of Python is later than mine your directory name will change).

Next Step: Get Easy Install (setuptools)

This can also be downloaded from the Python website. Again, just download whatever the latest version is (0.6c11 at the time of this writing). Install this — I was able to just click through every thing.

Fix your Path

For whatever reason the Python installer doesn’t configure your Path environment variable so we’ll need to do that manually.

  • Open your Start menu
  • Right-click on My Computer and select Properties
  • On Windows 7 or Windows Vista select Advanced Properties from the left, on Windows Server 2003 or earlier (including Windows XP) select the Advanced tab.
  • Click Environment Variables
  • Scroll through the System variables list until you find the Path variable
    • Note: There is also a PATH variable under the User variables for <your username> section. Don’t touch that.
  • Select the Path variable and click Edit
  • Go to the end of the Variable value text box and add “C:\Python26;C:\Python26\Scripts” (minus the quotes, obviously)
    • Obviously if you installed to a different location change the path above accordingly.

That’s it! Wasn’t that easy? To make sure you did everything correctly just open up a command prompt (Start -> Run -> “cmd” -> Enter) and type in “python” and hit enter — you should enter the Python REPL after a few seconds.

Whew, Finally! Install Pylons

Installing Pylons is super duper easy: Open a command prompt and just enter “easy_install pylons” — setuptools will take care of the rest!

Advertisements