简体   繁体   English

Mapnik python绑定安装错误

[英]Mapnik python bindings installation error

I've install mapnik by this tutorial https://github.com/mapnik/mapnik/wiki/WindowsInstallation . 我已通过本教程https://github.com/mapnik/mapnik/wiki/WindowsInstallation安装了mapnik。 I think installation over succeed becouse test on 6. step have not errors. 我认为安装成功是因为在步骤6上进行了测试没有错误。

Next I procceed by this tutorial: http://www.bostongis.com/PrinterFriendly.aspx?content_name=generating_osm_tiles 接下来,我将按照本教程进行操作: http : //www.bostongis.com/PrinterFriendly.aspx? content_name=generating_osm_tiles

and I try this command : python generate_xml.py osm.xml my_osm.xml --dbname=postgis --user postgres --port 5432 --extent 2430885.23, 6221979.54,2452356.05, 6243283.96 --accept-none 我尝试以下命令: python generate_xml.py osm.xml my_osm.xml --dbname=postgis --user postgres --port 5432 --extent 2430885.23, 6221979.54,2452356.05, 6243283.96 --accept-none

with this error: Error: saving xml requires Mapnik python bindings to be installed 出现此错误: Error: saving xml requires Mapnik python bindings to be installed

So I google python bindings and found this: https://github.com/mapnik/python-mapnik and install it pip install mapnik Collecting mapnik Downloading mapnik-0.1-cp27-none-any.whl (37.4MB) 100% |################################| 37.4MB 30kB/s Installing collected packages: mapnik Successfully installed mapnik-0.1 因此,我用google python绑定进行了搜索,发现了这一点: https : //github.com/mapnik/python-mapnik并安装它pip install mapnik Collecting mapnik Downloading mapnik-0.1-cp27-none-any.whl (37.4MB) 100% |################################| 37.4MB 30kB/s Installing collected packages: mapnik Successfully installed mapnik-0.1 pip install mapnik Collecting mapnik Downloading mapnik-0.1-cp27-none-any.whl (37.4MB) 100% |################################| 37.4MB 30kB/s Installing collected packages: mapnik Successfully installed mapnik-0.1

and next command python setup.py install 和下一个命令python setup.py install

with error: 错误:

Traceback (most recent call last):
  File "setup.py", line 87, in <module>
    ' +', ' ', cflags.replace('-g ', '').replace('-Os', '').replace('-arch i386', ''))
AttributeError: 'NoneType' object has no attribute 'replace'`

here is setup.py: http://pastebin.com/LZiGQTmz 这里是setup.py: http://pastebin.com/LZiGQTmz

I install mapnik 2.2 and python 2.7, and OS windows. 我安装了mapnik 2.2和python 2.7,以及OS窗口。 Any ideas please? 有什么想法吗?

I wouldn't expect open source projects to support Windows. 我不希望开源项目支持Windows。 I don't want to buy server licenses either. 我也不想购买服务器许可证。

I chose Vagrant and have no trouble following the portion of instructions concerning mapnik contained in tile-server-ubuntu . 我选择了Vagrant,并且完全按照tile-server-ubuntu中包含的有关mapnik的说明进行操作。 There are other ways, my raspberry pi was my first "win" but the least reproducible. 还有其他方法,我的树莓派是我的第一个“胜利”,但可复制性最低。

For posterity this is the code I used: 为了后代,这是我使用的代码:

Vagrantfile: Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/bionic64"
end

Shell commands: Shell命令:

sudo apt-get update
sudo apt-get -y install ca-certificates gnupg curl unzip gdal-bin tar wget bzip2 build-essential clang
#sudo apt-get install -y git  # git was already found
sudo apt-get install -y git autoconf libtool libxml2-dev libbz2-dev \
  libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal-dev g++ \
  libmapnik-dev mapnik-utils python-mapnik

shell test results: 外壳测试结果:

vagrant@ubuntu-bionic:~$ mapnik-config -v
3.0.19
vagrant@ubuntu-bionic:~$ mapnik-config --input-plugins
/usr/lib/mapnik/3.0/input
vagrant@ubuntu-bionic:~$ python -c "import mapnik;print mapnik.__file__"
/usr/lib/python2.7/dist-packages/mapnik/__init__.pyc

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

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