简体   繁体   English

DLL加载失败:无法在Windows上使用GDAL

[英]DLL load failed: Unable to use GDAL on windows

When I am trying to load GDAL I get: 当我尝试加载GDAL时,我得到:

C:\Windows\System32>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import gdal;
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python35\lib\site-packages\osgeo\__init__.py", line 21, in <module>
    _gdal = swig_import_helper()
  File "C:\Python35\lib\site-packages\osgeo\__init__.py", line 17, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)
  File "C:\Python35\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Python35\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found

How to know, which DLL it wants? 怎么知道,它想要哪个DLL? If it reported it's name, I would check the path. 如果它报告了它的名字,我会检查路径。

For now I have installed this 现在我安装了这个

http://download.gisinternals.com/sdk/downloads/release-1500-x64-gdal-2-1-3-mapserver-7-0-4/gdal-201-1500-x64-core.msi http://download.gisinternals.com/sdk/downloads/release-1500-x64-gdal-2-1-3-mapserver-7-0-4/gdal-201-1500-x64-core.msi

and this 和这个

http://download.gisinternals.com/sdk/downloads/release-1500-x64-gdal-2-1-3-mapserver-7-0-4/GDAL-2.1.3.win-amd64-py3.4.msi http://download.gisinternals.com/sdk/downloads/release-1500-x64-gdal-2-1-3-mapserver-7-0-4/GDAL-2.1.3.win-amd64-py3.4。 MSI

I have Python in C:\\Python35 and set it explicitly for while latter install. 我在C:\\Python35使用Python并在后一次安装时明确设置它。

Paths are set: 路径设置:

>echo %PATH%
C:\Python35;C:\Program Files\GDAL;C:\Python35\Scripts;

Variables are set 变量已设定

>echo %GDAL_DATA%
C:\Program Files\GDAL\gdal-data

>echo %GDAL_DRIVER_PATH%
C:\Program Files\GDAL\gdalplugins

What else voodoo to try? 还有什么伏都教可以尝试?

The main thing i notice is that you seem to have installed Python 3.4 bindings, but are using Python 3.5? 我注意到的主要是你似乎已经安装了Python 3.4绑定,但是使用的是Python 3.5? Is that correct? 那是对的吗? It could be a clue. 这可能是一个线索。

You can use something like Dependency Walker to investigate the issue further. 您可以使用Dependency Walker之类的东西来进一步调查此问题。 https://en.wikipedia.org/wiki/Dependency_Walker https://en.wikipedia.org/wiki/Dependency_Walker

And do you really have only three Paths in your PATH variable? 你的PATH变量中只有三个路径吗? With the PATH variable the order is important. 使用PATH变量,顺序很重要。

Since i switched to Miniconda + GDAL from the 'conda-forge' channel, my DLL issues (nearly) diminished, i highly recommend it. 由于我从'conda-forge'频道切换到Miniconda + GDAL,我的DLL问题(几乎)减少了,我强烈推荐它。 That doesn't answer your question though. 但这并不能回答你的问题。

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

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