Hi all,

Yesterday, I had to build a Cython extension for a colleague using
Windows, so here are the steps required:

1. Install Wine (on OSX I used http://www.macports.org/)
2. Install Python 2.5 from the http://www.python.org .exe
3. Install mingw from http://www.mingw.org/.  Install the base system and g++.
4. Start the registry editor (wine regedit) and setup the system path:

 - Search for Environment and find the PATH key
 - Append to it c:\python25;c:\mingw\bin;c:\python25\scripts
 - Add a new key called "HOME" and set it to c:\windows\profiles\yourusername

5. Create a new file in ~/.wine/drive_c/windows/profiles/yourusername/
called pydistutils.cfg that contains

[build]
compiler=mingw32

This tells distutils not to look for MSVC7, but to use mingw as the
default compiler.

6. Install setuptools (not necessary, but convenient if you want to
install any other packages).

Get the .tar.gz from http://pypi.python.org/pypi/setuptools.
Unpack.
wine python setup.py install

7. Install Cython (either from source as in 6 or using `easy_install cython`)
8. Compile you extension (from your package source directory):

python setup.py bdist_wininst

This will only work if you have a setup.py file, similar to the one in

http://dip.sun.ac.za/~stefan/code/cython_demo.git

This step should then generate a .exe in the dist/ directory.

If your package requires NumPy to work, you'll have to install that
prior to step 8, by

1. Extracting the numpy source tree
2. python setup.py build -c mingw32
3. python setup.py install --skip-build

I hope someone else finds this recipe useful!

Regards
Stéfan
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to