Updated Python3k (markdown)
parent
6fd4980818
commit
daed56e620
1 changed files with 6 additions and 5 deletions
11
Python3k.md
11
Python3k.md
|
@ -2,7 +2,6 @@
|
|||
<!-- Version: 2 -->
|
||||
<!-- Last-Modified: 2010/09/28 12:12:20 -->
|
||||
<!-- Author: springmeyer -->
|
||||
*= 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 "<stdin>", line 1, in <module>
|
||||
File "/usr/local/lib/python3.1/site-packages/mapnik2/__init__.py", line 54, in <module>
|
||||
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.
|
||||
|
||||
|
|
Loading…
Reference in a new issue