我发现以下适用于Windows:
- 运行
python
以检查你的python是32位还是64位。 - 将相应的OSGeo4W(32或64位)安装到
C:OSGeo4W
或中C:OSGeo4W64:
- 注意:选择“快速Web-GIS安装”,然后单击“下一步”。
- 在“选择软件包”列表中,确保已选择GDAL;默认情况下,MapServer和Apache也处于启用状态,可能会被安全地取消选中。
- 确保以下内容包含在你的中
settings.py:
import osif os.name == 'nt': import platform 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"sharegdal" os.environ['PROJ_LIB'] = OSGEO4W + r"shareproj" os.environ['PATH'] = OSGEO4W + r"bin;" + os.environ['PATH']
- 运行python manage.py check以验证geodjango是否正常工作。


![Windows上的GeoDjango:“找不到GDAL库” /“ OSError:[WinError 126]找不到指定的模块” Windows上的GeoDjango:“找不到GDAL库” /“ OSError:[WinError 126]找不到指定的模块”](http://www.mshxw.com/aiimages/31/368015.png)
