python - When configuring Geodjango, gdal1.10 and python3.3 are incompatible on Windows7 -
i using windows7 develop geodjango app, python version 3.3. following steps django documentation, installed postgresql9.1 , postgis extension. when installing gdal library, there problem. install gdal
http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
which says has required files. me, can not correctly set up. test
from django.contrib.gis import gdal
and following errors prompt out:
>>> django.contrib.gis import gdal traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\program files\python33\lib\site-packages\django\contrib\gis\gdal\__in it__.py", line 41, in <module> django.contrib.gis.gdal.driver import driver file "c:\program files\python33\lib\site-packages\django\contrib\gis\gdal\driv er.py", line 5, in <module> django.contrib.gis.gdal.prototypes import ds capi file "c:\program files\python33\lib\site-packages\django\contrib\gis\gdal\prot otypes\ds.py", line 8, in <module> django.contrib.gis.gdal.libgdal import lgdal file "c:\program files\python33\lib\site-packages\django\contrib\gis\gdal\libg dal.py", line 47, in <module> lgdal = cdll(lib_path) file "c:\program files\python33\lib\ctypes\__init__.py", line 353, in __init__ self._handle = _dlopen(self._name, mode) oserror: [winerror 193] %1 not valid win32 application。 >>>
so check file of libgdal.py in python3.3, , find there no lib name gdal1.10, following code:
elif os.name == 'nt': # windows nt shared libraries lib_names = ['gdal19', 'gdal18', 'gdal17', 'gdal16', 'gdal15']
so change
elif os.name == 'nt': # windows nt shared libraries lib_names = ['gdal110', 'gdal19', 'gdal18', 'gdal17', 'gdal16', 'gdal15']
why did because find gdal installed 'gdal110.dll' file within python site-package folder.
c:\program files\python33\lib\site-packages\osgeo
however, modification doesn't work either.
then tried add line settings.py of django.
gdal_library_path = 'c:\program files\python33\lib\site-packages\osgeo\gdal110.dll'
it still not work, error message before.
can point me way out?
the problem has settled, used accepted answer
unable install python , gdal (dll load failed)
and workds, did before this, rename osgeo4w folder(i.e. delete them). django able find gdal django.contrib.gis.
Comments
Post a Comment