简体   繁体   中英

DLL load failed: Unable to use GDAL on windows

When I am trying to load GDAL I get:

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? 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

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

I have Python in C:\\Python35 and set it explicitly for while latter install.

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? Is that correct? It could be a clue.

You can use something like Dependency Walker to investigate the issue further. https://en.wikipedia.org/wiki/Dependency_Walker

And do you really have only three Paths in your PATH variable? With the PATH variable the order is important.

Since i switched to Miniconda + GDAL from the 'conda-forge' channel, my DLL issues (nearly) diminished, i highly recommend it. That doesn't answer your question though.

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