简体   繁体   English

如何在运行Enthought Canopy的linux机器上为mapnik设置python绑定

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

I currently use Enthought Canopy to run python. 我目前使用Enthought Canopy运行python。
I would like to use Mapnik, I have successfully installed this on my machine 我想使用Mapnik,我已经在机器上成功安装了它

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. 我也相信PATH变量是正确的,因为其他模块可以正确导入,尽管所有这些模块都是通过机盖包安装程序安装的。

Can anyone help me with a fix, or is mapnik not supported by canopy? 有人可以帮我解决问题,还是机盖不支持mapnik? If the canopy team see this, can you add mapnik to the package installer? 如果顶篷团队看到此信息,您可以将mapnik添加到软件包安装程序中吗?

Thanks Ed 谢谢爱德

you probably built mapnik against a different python installation. 您可能针对不同的python安装构建了mapnik。 Check the first lines of output when building mapnik to find out the python site packages where Mapnik was installed: 在构建mapnik时检查输出的第一行,以查找安装了Mapnik的python站点软件包:

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. 我碰巧,用于运行mapnik scons构建的python二进制是2.7.5,而构建过程选择了2.6版本。 I solved using the ./configure (just use the same options you used with scons.py), make and sudo make install. 我解决了使用./configure(只需使用与scons.py相同的选项),make和sudo make install。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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