From daed56e620332b4cadf8600c67f9b83ec91f95b9 Mon Sep 17 00:00:00 2001 From: ThomasG77 Date: Tue, 20 Dec 2011 13:54:27 -0800 Subject: [PATCH] Updated Python3k (markdown) --- Python3k.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Python3k.md b/Python3k.md index 7700e11..93493c7 100644 --- a/Python3k.md +++ b/Python3k.md @@ -2,7 +2,6 @@ -*= Python3k = Mapnik supports Python 3k as of r2239. Mapnik uses Boost Python for its Python bindings, and boost gained Python 3 support at the 1.41 release, thanks to the excellent work of Haoyu Bai. Haoyu also provided the patch for initial py3k support for Mapnik. @@ -31,9 +30,9 @@ After [building boost](/wiki:Mapnik2#BuildingBoost/), you should have `libboost_ You'll need to set `BOOST_INCLUDES` and `BOOST_LIBS` to your custom Boost build, set `BOOST_PYTHON_LIB = 'boost_python3'`, and `PYTHON = '/usr/local/bin/python3'`. You might also want to set `PYTHON_PREFIX` to install the Python binding to a customized location. - - #!sh +```sh $ python scons/scons.py PYTHON=/usr/local/bin/python3 BOOST_PYTHON_LIB=boost_python3 +``` *Note:* The SCons scripts, written in python, don't actually support Python3, but using the above command you can still compile Mapnik's python bindings against python3 (while the python uses to run SCons < 3). @@ -47,18 +46,20 @@ During the install the SCons build scripts will automatically run the python3 pr If this fails you will simply see this: - #!python +```python Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.1/site-packages/mapnik2/__init__.py", line 54, in from _mapnik2 import * ImportError: No module named _mapnik2 +``` In this case you need to manually run 2to3 over the installed bindings: - +```sh $ cd $PYTHON_PREFIX/lib/python3.1/site-packages/mapnik2 $ 2to3 -w . +``` You will see the patch generated by 2to3, and the `-w` option indicates 2to3 to write the patch back to the files.