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
- Python 2.2.2
- Download the Windows installer Python-2.2.2.exe.
- Install Python into a directory, eg. C:\Python22, call this PYTHON_PATH.
- Go to My Computer->Properties->Advanced->Environment Variables->System Variables.
- Edit the PATH variable and add PYTHON_PATH to the end.
- Open Notepad, or your favourite text editor.
- 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
- Save the file as run_python.bat in PYTHON_PATH, ie. the Python directory.
- Python Imaging Library (PIL) 1.1.3
- Download the Windows installer PIL-1.1.3.win32-py2.1.exe
- Install PIL into the Python directory.
- PyOpenGL 2.0.0.44
- Download the Windows installer PyOpenGL-2.0.0.44.win32-py2.2.exe
- Install PyOpenGL into the Python directory.
- GLUT 3.7.6
- Download the package glut-3.7.6-bin.zip.
- Unzip it to a temporary directory.
- Copy glut32.dll to C:\Windows\system32.
- Copy glut.h to VC_PATH\vc7\PlatformSDK\include\gl.
- Copy glut32.lib to VC_PATH\vc7\PlatformSDK\lib.
Modifying the setup.py file and the other donated code files
- 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
- 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.