简体   繁体   中英

How to set python bindings for mapnik on a linux machine running Enthought Canopy

I currently use Enthought Canopy to run python.
I would like to use Mapnik, I have successfully installed this on my machine

In a terminal

mapnik -config -v 

results in

2.2.0

However

python -c "import mapnik;print mapnik.__file__"

results in

an import error showing that there is no module named mapnik

I believe this is due to me not setting the bindings properly. I also believe that the PATH variable is correct as other modules import properly, although all of these have been installed through the canopy package installer.

Can anyone help me with a fix, or is mapnik not supported by canopy? If the canopy team see this, can you add mapnik to the package installer?

Thanks Ed

you probably built mapnik against a different python installation. Check the first lines of output when building mapnik to find out the python site packages where Mapnik was installed:

Checking for C header file Python.h... yes
Bindings Python version... 2.6
Python 2.6 prefix... /usr
Python bindings will install in... /usr/lib64/python2.6/site-packages

It happened to me that the python binary used to run the mapnik scons build was the 2.7.5 while the build process picked up the 2.6 version. I solved using the ./configure (just use the same options you used with scons.py), make and sudo make install.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM