GeoDjango on Windows: “Could not find the GDAL library” / “OSError: [WinError 126] The specified module could not be found”

后端 未结 8 1543
青春惊慌失措
青春惊慌失措 2020-11-28 06:58

I\'ve been trying to setup my windows computer such that I can have a local postgreSQL with PostGIS extension. With this installed I hope to be able to create a project with

8条回答
  •  孤城傲影
    2020-11-28 07:45

    Steps to follow:

    1. Run python to check if your python is 32 or 64 bit.
    2. Install corresponding OSGeo4W (32 or 64 bit) into C:\OSGeo4W or C:\OSGeo4W64:
      Note: Select Express Web-GIS Install and click next.
    3. In the ‘Select Packages’ list, ensure that GDAL is selected; MapServer and Apache are also enabled by default.
    4. Make sure the following is included in your settings.py:
    import os
    GDAL_LIBRARY_PATH = r'C:\OSGeo4W\bin\gdal300'
    
    1. Now, run the server still if it doesn't work. Run the following commands in terminal.
    set OSGEO4W_ROOT=C:\OSGeo4W
    set PYTHON_ROOT=C:\Python3X 
    set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal 
    set PROJ_LIB=%OSGEO4W_ROOT%\share\proj
    

提交回复
热议问题