Я использую Windows 10 (x64), Python 3.6.4, Django 2.0.5.
Я установил OSGEO4W64 на мою машину (C: \ OSGeo4W64).
Я устанавливаю переменные окружения:
GDAL_LIBRARY_PATH = C: \ OSGeo4W64 \ share \ proj
GDAL_DATA = C: \ OSGeo4W64 \ share \ gdal
OSGEO4W_ROOT = C: \ OSGeo4W64
PROJ_LIB = C: \ OSGeo4W64 \ share \ proj
Кроме того, в мои настройки проекта djanjo добавлено:
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"\share\gdal"
os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj"
os.environ['PATH'] = OSGEO4W + r"\bin;" + os.environ['PATH']
GDAL_LIBRARY_PATH = r'C:\OSGeo4W64\bin\gdal202'
Я понимаю, что это выглядит некрасиво, но это помогло мне избежать других проблем (например, с неопознанными библиотеками).
И теперь я просто не могу исправить эту ошибку:
Traceback (most recent call last):
File "C:\oktmo_Django\oktmo_project/manage.py", line 13, in <module>
execute_from_command_line(sys.argv)
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\core\management\__init__.py", line 347, in execute
django.setup()
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\apps\registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Python\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\contrib\gis\gdal\__init__.py", line 28, in <module>
from django.contrib.gis.gdal.datasource import DataSource
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\contrib\gis\gdal\datasource.py", line 39, in <module>
from django.contrib.gis.gdal.driver import Driver
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\contrib\gis\gdal\driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\contrib\gis\gdal\prototypes\ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
File "C:\oktmo_Django\oktmo_project\venv\lib\site-packages\django\contrib\gis\gdal\libgdal.py", line 43, in <module>
lgdal = CDLL(lib_path)
File "C:\Python\lib\ctypes\__init__.py", line 416, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] The specified procedure could not be found