Note on PySFML 1.5: Though his tutorial was written for 1.4, it works without modification for 1.5. Only change; if you ever see something like SFML-1.4, pretend it says SFML-1.5.
Unfortunately, the instructions in the general tutorial section of the SFML website do not work for PySFML 1.4 and SFML when you use VC++ 2008 on Windows. Luckily, there are not too many additional steps. This tutorial originates from a forum topic. This tutorial has only been tested with given specifications, but analogous steps should work for Visual C++ 2005. This require an installed version of Microsoft's Visual C++ 2008 software. Luckily, there is a free version of it, Exrpess Editions.
This will elaborate upon the installation guide's section “Installing PySFML SDK”. The provided development files do not work with Python 2.6, so we must install the SDK.
First, download both the SFML full SDK under the C++ libraries downloads. Also download the PySFML SDK. Extract both of these files to the same folder. This will get you one directy SFML-1.4 which contains the contents of the SFML full SDK and a “python” sub-folder. Inside the python sub-folder, open the setup.py file with your python editor of choice. Two changes must be made: we must tell it to look in the Visual C++ 2008 folder for libraries and that we are linking to SFML dynamically. The first change is easy; change line 22 to look like this:
library_dirs=['../lib/vc2008'], \
For the second change, we must define a macro. Add a comma to the end of line 23 and then add this line after line 23:
define_macros=[('SFML_DYNAMIC',None)]
Now, our setup.py file is ready. As in the original tutorial, we shall run it by opening our command line to the SFML-1.4\python folder where setup.py is located and tell it:
python setup.py build
This should proceed to build the Python bindings for SFML and may take several minutes. It will output a lot. This should have given us a file sf.pyd inside the folder SFML-1.4\python\build\lib.win32-2.6. The next step also goes as the tutorial says. We install these newly built bindings to our Python installation with this command:
python setup.py install
We have one last step now. We must provide the installation with the proper DLL files. In the SFML-1.4\lib\vc2008 folder, copy sfml-graphics.dll, sfml-system.dll, sfml-window.dll, and sfml-audio.dll. Go to your Python 2.6 installation (eg: C:\Python26\) and find the Lib\site-packages folder. If the install went properly, we'll see a PySFML folder there. Open that up and paste the DLLs there. Head back to the SFML-1.4 folder and go to the extlibs\bin folder and copy the two DLLs found there, libsndfile-1.dll and openal32.dll. Paste these into the Lib\site-packages\PySFML folder as you did the others.
Now it should all be ready! Open a Python interpreter and try from PySFML import sf and check that it works.