Setting up your Windows 7 machine for Python scientific work

A few days ago, I wrote a blog about setting up Python and (many science related modules) on a Mac. Well, today, I had to do the same on a windows 7 machine that I have to use for work. I never thought I'd say this but it turns out it was easy on windows (way easier than on my Mac ... I feel pain just writing this, and no, it won't make me like Windows). Here is how I did it.

Installing Python

I started the installation by following instructions from this link, which basically told me to install Python from the official Python page (apparently, it was recommended to install the 32 bit version ... even if my computer is 64 bit). I installed Python 2.7.3. It downloads an installer, which you simply open and follow the instructions.

The installer will not automatically set-up your system path to use python, so we have to do it manually.

  • Right-click Computer and select Properties.
  • In the dialog box, select Advanced System Settings.
  • In the next dialog, select Environment Variables.
  • In the User Variables section, edit the PATH statement (or create a PATH variable if it does not exist) to include this:

C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;

Once the PATH is set up, you should be able to run python from the command line (open Start Menu > All Programs > Accessories > Command Prompt and type python).

Installing Python modules

  • setuptools: installs easy_install. Download the setuptools installer here and simply run it.
  • pip: from the command prompt => easy_install pip
  • numpy: Download the installer here and run it.
  • ipython: last but not least, download ipython here (you'll need admin rights if you want the installer to put a item in the start menu)
  • pyfits: pip install pyfits
  • astropysics: pip install astropysics
  • pyephem: easy_install pyephem
  • lmfit: pip install lmfit

Comments

Popular Posts