更新时间:2023-02-24 08:05:13
我发现以下内容适用于 Windows:
I have found the following to work for windows:
python
以检查您的 python 是 32 位还是 64 位.C:OSGeo4Wcode> 或 C:OSGeo4W64
:
-
注意:选择 Express Web-GIS Install 并单击下一步.
- 在Select Packages"列表中,确保选择了 GDAL;MapServer 和 Apache 也默认启用,可以安全地取消选中.
- Run
python
to check if your python is 32 or 64 bit.
- Install corresponding OSGeo4W (32 or 64 bit) into
C:OSGeo4W
or C:OSGeo4W64
:
-
Note: Select Express Web-GIS Install and click next.
- In the ‘Select Packages’ list, ensure that GDAL is selected; MapServer and Apache are also enabled by default, may be unchecked safely.
确保您的 settings.py
中包含以下内容:
Make sure the following is included in your settings.py
:
import os
if 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"in;" + os.environ['PATH']
-
运行 python manage.py check
以验证 geodjango 是否正常工作.
-
Run python manage.py check
to verify geodjango is working correctly.