无法找到模块“C:\OSGeo4W in\gdal308.dll”(或其依赖项之一)

问题描述 投票:0回答:1

我正在尝试使用 GeoDjango + gdal + PostGis 来创建地图应用程序。

OSGeo4W已完全安装,所有dll文件都在

当我运行此命令时:

python3 manage.py check

我得到以下结果:

                   ^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\OSGeo4W\bin\gdal308.dll' (or one of its dependencies). Try using the full path with constructor syntax.

但是文件正确存在于该位置。这是我的设置文件的样子,对于 gdal 部分:

if os.name == 'nt':
    OSGEO4W = r"C:\\OSGeo4W"
    # if '64' in platform.architecture()[0]:
    #     OSGEO4W += "64"
    assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W
    os.environ['OSGEO4W_ROOT'] = OSGEO4W
    os.environ['GDAL_DATA'] = OSGEO4W + r"\\share\\gdal"
    os.environ['PROJ_LIB'] = OSGEO4W + r"\\share\\proj"
    os.environ['PATH'] = OSGEO4W + r"\\bin;" + os.environ['PATH']
    GDAL_LIBRARY_PATH = OSGEO4W + r"\\bin\\gdal308.dll"

有经历过这个问题的人可以帮我解释一下吗?

python django postgis gdal geodjango
1个回答
0
投票

你要“新”了。 GeoDjango 仅支持 GDAL 至 v.3.7。

阅读文档:Django DOCs - 安装地理空间库

© www.soinside.com 2019 - 2024. All rights reserved.