Setting up Python and other tools for CS488 on Windows XP

Disclaimer

These instructions are based on what I have done on my machine and does not guarantee that it will work on your machine.

Note

You will need Visual Studio .NET (it will probably work with most Visual Studio distribution) installed on your system, eg. C:\Program Files\Microsoft Visual Studio .NET, call this VC_PATH.

Software You'll Need

  1. Python 2.2.2
    1. Download the Windows installer Python-2.2.2.exe.
    2. Install Python into a directory, eg. C:\Python22, call this PYTHON_PATH.
    3. Go to My Computer->Properties->Advanced->Environment Variables->System Variables.
    4. Edit the PATH variable and add PYTHON_PATH to the end.
    5. Open Notepad, or your favourite text editor.
    6. Place the following two lines in the file, replacing the path variables with your own.

      Call VC_PATH\vc7\bin\vcvars32.bat
      PYTHON_PATH\python.exe %1

    7. Save the file as run_python.bat in PYTHON_PATH, ie. the Python directory.
  2. Python Imaging Library (PIL) 1.1.3
    1. Download the Windows installer PIL-1.1.3.win32-py2.1.exe
    2. Install PIL into the Python directory.
  3. PyOpenGL 2.0.0.44
    1. Download the Windows installer PyOpenGL-2.0.0.44.win32-py2.2.exe
    2. Install PyOpenGL into the Python directory.
  4. GLUT 3.7.6
    1. Download the package glut-3.7.6-bin.zip.
    2. Unzip it to a temporary directory.
    3. Copy glut32.dll to C:\Windows\system32.
    4. Copy glut.h to VC_PATH\vc7\PlatformSDK\include\gl.
    5. Copy glut32.lib to VC_PATH\vc7\PlatformSDK\lib.

Modifying the setup.py file and the other donated code files

  1. In setup.py, add the following:
    if sys.platform = = 'win32':
         std_include_dirs += ['c:\\Program Files\\Microsoft Visual Studio .NET\\vc7\\PlatformSDK\\include\\gl' ]
         std_library_dirs += ['c:\\Program Files\\Microsoft Visual Studio .NET\\vc7\\PlatformSDK\\lib' ]
         std_libraries = [ 'GLU32', 'OpenGL32' ]
    This is where it says in the comments that there should be a 'windows' section too. Change the include and library directories with your own VC_PATH
  2. In any files that include gl.h, etc., add the following before including gl.h.
    #ifdef _WIN32
    #include <windows.h>
    #endif

Integrating Python into MSDEV

These extra instructions come from Frédéric Hamel:

If you're on Windows and you like MSDEV, you can kind of integrate it with Python using the Tools menu. Tools/Customize will allow you to add an entry or two to compile and/or run the program from MSDEV itself. The nifty part is that if you redirect the output to console, you can use regular error-browsing features (F4, double-clicking, etc.) for the C code. For example:

Command: c:\python22\python.exe
Arguments: setup.py
Initial directory: $(CurDir)

Don't forget to check "Use output window" for error-browsing.

This was tested on msdev 6.0, but it probably works on 7.0/.net as well.