因为课程需要,需要将shapefile格式的数据储存进入mysql来进行查询等操作。
google百度之后发现GDAL的org2org命令行工具可以将shp文件储存进mysql。
编译gdal-2.1.3\swig\python文件夹下的setup.py文件:
python setup.py build
出现错误:
running build
running build_py
running build_ext
building 'osgeo._gdal' extension
error: INCLUDE environment variable is empty
找了setup.py文件下的的含有“osgeo._gdal”代码,发现这段代码引用了目录下的文件夹extension中的gdal_wrap文件
gdal_module = Extension('osgeo._gdal',
sources=['extensions/gdal_wrap.cpp'],
extra_compile_args = extra_compile_args,
extra_link_args = extra_link_args)
不知道怎么办,于是下载了别人编译好的GDAL,直接安装在了我的python的Lib\site-packages文件夹下,但是再引用ogr2ogr.py文件时,还是报错:
Traceback (most recent call last):
File "ogr2ogr.py", line 42, in <module>
from osgeo import gdal
File "C:\Users\Administrator\De