赞
踩
1.1、gdal-3.1.4.tar.gz Download — GDAL documentation\GitHub - OSGeo/gdal: GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
1.2、 proj-6.2.1.tar.gz Download — PROJ 9.3.0 documentation \Download — PROJ 9.3.0 documentation
1.3、geos-3.7.3.tar.bz2 Index of /geos/
2.1、安装proj
tar -xf proj-6.2.0.tar.gz #解压
cd proj-6.2.0 #进入解压目录
./configure --prefix=/home/share/wli/software/proj/6.2.0
make
make install
2.2、安装gdal
./configure --prefix=/home/share/wli/software/gdal/2.2.3
make
make install
2.3、安装python版的gdal
cd /gdal-2.2.3/swig/python/
python setup.py build
python setup.py install
- $ python setup.py build
- $ python setup.py install
2.4、import gdal 会报:No module named _gdal
生成指定变量 (gdal位置 显示安装结束前 Installed /home/.../.egg)
export PYTHONPATH=/home/share/wli/software/anaconda3c/lib/python3.7/site-packages/GDAL-2.2.2-py3.7-linux-x86_64.egg/osgeo/:$PYTHONPATH
5、最后import gdal 测试出现
OSError: libgdal.so.27: cannot open shared object file: No such file or directory
解决办法:
查了一下错误原因,原来是系统不知道GDAL共享库的加载路径。在~/.bashrc中加入一行: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
,然后执行source .bashrc
。问题解决,大功告成。
$ python
Python 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 21:52:21)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
2、python - No module named _gdal - Stack Overflow
3、main__.gdal_config_error: [Errno 2] No such file or directory: ‘gdal-config (gdal源码安装)-CSDN博客
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。