Here you’ll find all the necessary explainations for installing the binding on your favorite platform. Unfortunately the procedures for Mac OSX and Windows 8 are not yet available.
Simply download the correct installer and follow the instructions.
Note
If you experience issues during installation, try running the installer again in compatibility mode:
- Right-click the installer and select “Properties”
- Navigate to the “Compatibility” tab.
- Check “Run this program in compatibility mode for”
- Select “Windows XP (Service Pack 3)
While official support for Mac OSX is slated for the next release, those eager should feel free to download the source code and compile manually.
For example, through pip (don’t forget to have cython 0.19 and SFML 2.0 installed and as mentioned below):
pip install git+git://github.com/Sonkun/python-sfml.git
Packages are available (for Ubuntu 12.04LTS, 12.10 & 13.04LTS) via launchpad:
sudo add-apt-repository ppa:sonkun/sfml-stable
sudo apt-get update
sudo apt-get install python-sfml
# or
sudo apt-get install python3-sfml
Want the development version ? Use ppa:sonkun/sfml-development repository.
Note
The sonkun/sfml-stable ppa provides many packages. The library SFML and the bindings are included along with their examples. Packages are:
- libsfml
- libsfml-dev
- libsfml-dbg
- libsfml-doc
- sfml-examples
- python-sfml
- python3-sfml
- python-sfml-doc
- pysfml-examples
Once example packages are installed you may want to launch them to see if the library works well with your graphics card. To do that just run the following commands.
sfml-sound # will run the example 'sound'
sfml-shader
sfml-X11
sfml-voip
pysfml-sound # will run the same example but it's actually a python script that uses the binding
pysfml-pong
pysfml-sockets
pysfml-spacial-music
pysfml-pyqt4
Packages are available here
See Ubuntu section to know what you can do with the example package.
Before attempting to compile, it is important that you obtain a copy of the source code, either from git:
git clone git://github.com/Sonkun/python-sfml.git
You’ll also need SFML and Cython 0.19 installed on your computer.
In order to compile, you’ll need the Python developement files.
To build the bindings for Python, type:
python2 setup.py install
python3 setup.py install
Compiling on Windows requires more steps.
To have binaries fully compatible you should compile with the optimizing C/C++ compiler used to build Python for Windows. The SDK can be downloaded on the microsoft download center:
For Python 2.7 & 3.2: Windows SDK 7.0
For Python 3.3: Windows SDK 7.1
You need GRMSDKX_EN_DVD.iso if you target a AMD64 Python version. It can build for x86 arch too.
Observe that you don’t need Microsoft Visual C++ Express.
If SFML headers and libraries aren’t installed in the respective compilers, do it now. It would look like:
C:\Porgram Files (x86)\Microsoft Visual Studio 9\VC\include\SFML
C:\Porgram Files (x86)\Microsoft Visual Studio 9\VC\lib\sfml-system-2.lib
C:\Porgram Files (x86)\Microsoft Visual Studio 9\VC\lib\sfml-window-2.lib
...
Open the SDK command window and type:
C:\Program Files\Microsoft SDKs\Windows\v7.0>set DISTUTILS_USE_SDK=1
C:\Program Files\Microsoft SDKs\Windows\v7.0>setenv /x64 /release
Adjust according the targetted architecture (x86 or x84) and mode (release or debug).
Then head to the source directory and type:
python setup.py install
You’ll still need sfml DLLs in your source directories unless you copy them in the Python Lib directory: /PythonXY/Lib/site-packages/sfml/sfml-*.dll
Note
I use an internal version of setup.py to create the available Windows installers in order to to include DLLs, so you don’t need to compile it when using installers.