简体   繁体   English

使用Python 2.7在Windows 7中安装Mapnik 2.2.0

[英]Installing Mapnik 2.2.0 in windows 7 with Python 2.7

I've been trying to install mapnik on my computer for hours but what i always get when I import mapnik is ImportError: DLL load failed: The specified procedure could not be found . 我一直在尝试在我的计算机上安装mapnik几个小时,但是当我导入mapnik时我总是得到的是ImportError: DLL load failed: The specified procedure could not be found

I'm using Windows 7. The currently installed software is Geoserver from Opengeo suite. 我使用的是Windows 7.目前安装的软件是Opengeo套件的Geoserver。

Here is my path 这是我的道路

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jdk1.7.0_45\bin;C:\Python27;C:\mapnik-v2.2.0\lib

My python path: 我的python路径:

C:\Python27;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Program Files\ArcGIS\bin;C:\\mapnik-v2.2.0\python\2.7\site-packages\;C:\mapnik-v2.2.0\bin\;

Follow the install instructions 按照安装说明进行操作

First ensure you have 32 bit python 27 installed. 首先确保你安装了32位python 27。

You can do this by typing the following into a python shell 您可以通过在python shell中键入以下内容来完成此操作

>>> import platform
>>> platform.architecture()
('32bit', 'WindowsPE')

If you see '64bit' , try reinstalling python with the 32bit version (look for the "Python 2.7.5 Windows Installer" link). 如果您看到'64bit' ,请尝试使用32bit版本重新安装python (查找“Python 2.7.5 Windows Installer”链接)。

After that, 之后,

  • Download the mapnik package (I tested it with the full SDK version) 下载 mapnik包(我用完整的SDK版本测试了它)
  • Extract the archive to C:\\mapnik-v2.2.0 将存档解压缩到C:\\mapnik-v2.2.0
  • Add C:\\mapnik-v2.2.0\\lib; 添加C:\\mapnik-v2.2.0\\lib; and C:\\mapnik-v2.2.0\\bin; C:\\mapnik-v2.2.0\\bin; to your PATH 到你的PATH
  • Add C:\\mapnik-v2.2.0\\python\\2.7\\site-packages; 添加C:\\mapnik-v2.2.0\\python\\2.7\\site-packages; to your PYTHONPATH 到你的PYTHONPATH

import mapnik

I had the same issue on WinServewr 2008 R2. 我在WinServewr 2008 R2上遇到了同样的问题。 The solution I found is to install Microsoft Visual C++(x86) redistributable package 10.0.40219, because mapnik depends on it. 我找到的解决方案是安装Microsoft Visual C ++(x86)可再发行组件包 10.0.40219,因为mapnik依赖于它。 This package comes with postgreSQL 9.3 x86, so when you install only Postgre x64 version you can have this error. 此软件包附带postgreSQL 9.3 x86,因此当您只安装Postgre x64版本时,您可能会遇到此错误。

I had this problem as well, even after I installed a 32-bit Python. 即使在我安装了32位Python之后,我也遇到了这个问题。 I was getting the same error: 我得到了同样的错误:

ImportError: DLL load failed: The specified procedure could not be found.

What fixed it in the end was copying all the DLLs to my python executable directory. 最后修复它的是将所有DLL复制到我的python可执行文件目录。 I assume there was some DLL-hell type action going on and it was linking to a DLL somewhere with the same name but without that entrypoint. 我假设有一些DLL-hell类型的动作正在进行,并且它链接到一个具有相同名称但没有该入口点的DLL。 What entrypoint it was looking for I do not know. 它正在寻找什么入口点我不知道。

In the end it was all useless though because it turns out that there is no OSM (OpenStreetMaps) plugin for the 2.2.0 version, so I decided to do this on Linux instead. 最后它完全没用,因为事实证明2.2.0版本没有OSM(OpenStreetMaps)插件,所以我决定在Linux上这样做。

See the table at https://github.com/mapnik/mapnik/wiki/WindowsInstallation for the reference of a missing OSM plugin - execution results in a runtime error indicating the plugin could not be loaded. 请参阅https://github.com/mapnik/mapnik/wiki/WindowsInstallation中的表格以获取缺少的OSM插件的参考 - 执行会导致运行时错误,指示无法加载插件。

I think Windows binary support for mapnik has been dropped so I don't expect much change here. 我认为对mapnik的Windows二进制支持已被删除,所以我不希望这里有太大的变化。

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

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