使用conda在windows上安装gdal python库(DLL加载失败)



我正在尝试使用conde:在windows中安装gdal

> conda install gdal

当我尝试时:

import gdal

我得到这个错误。

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-9-ee38efafc30b> in <module>()
----> 1 import gdal
C:UsersmiladAnaconda2libsite-packagesgdal.py in <module>()
1 # import osgeo.gdal as a convenience
----> 2 from osgeo.gdal import deprecation_warn
3 deprecation_warn('gdal')
4 
5 from osgeo.gdal import *
C:UsersmiladAnaconda2libsite-packagesosgeo__init__.py in <module>()
23                 fp.close()
24             return _mod
---> 25     _gdal = swig_import_helper()
26     del swig_import_helper
27 else:
C:UsersmiladAnaconda2libsite-packagesosgeo__init__.py in swig_import_helper()
19         if fp is not None:
20             try:
---> 21                 _mod = imp.load_module('_gdal', fp, pathname, description)
22             finally:
23                 fp.close()
ImportError: DLL load failed: The specified procedure could not be found.

它没有说明它缺少什么dll。

使用import gdal而不是from osgeo import gdal

from osgeo import gdal
print(gdal.VersionInfo("–version"))
#> GDAL 3.6.3, released 2023/03/07

我一直在努力让GDAL为python工作,所以我在这里发布了一个指南:https://github.com/felipunky/GISPython/blob/master/README.md向下滚动到"安装我们将在python脚本中使用的库"部分。

最新更新