对于即将进行的研究项目,我将需要将Python与GIS数据(主要是栅格数据)结合使用。我有使用Matlab和R的经验;但是,Python对我来说还是一个相对未知的领域。我已经能够在计算机上安装Anaconda并下载所需的必需软件包并成功导入(例如Richdem);但是,gdal一直持续疼痛。
import gdal
在Spyder中导致...
ImportError: dlopen(/Users/matthew/anaconda3/lib/python3.6/site-packages/osgeo/_gdal.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libfontconfig.1.dylib
Referenced from: /Users/matthew/anaconda3/lib/libpoppler.78.dylib
Reason: Incompatible library version: libpoppler.78.dylib requires version 14.0.0 or later, but libfontconfig.1.dylib provides version 13.0.0
我尝试过: 1)更新conda 2)更新anaconda 3)更新python 4)通过pip安装GDAl 5)使用conda-forge重新安装GDAL
conda列表gdal
# Name Version Build Channel
gdal 2.4.1 py36h7eb7563_3 conda-forge
libgdal 2.4.1 h1405c63_3 conda-forge
conda信息
active environment : None
user config file : /Users/matthew/.condarc
populated config files : /Users/matthew/.condarc
conda version : 4.6.14
conda-build version : 3.17.8
python version : 3.6.8.final.0
base environment : /Users/matthew/anaconda3 (writable)
channel URLs : https://conda.anaconda.org/conda-forge/osx-64
https://conda.anaconda.org/conda-forge/noarch
package cache : /Users/matthew/anaconda3/pkgs
/Users/matthew/.conda/pkgs
envs directories : /Users/matthew/anaconda3/envs
/Users/matthew/.conda/envs
platform : osx-64
user-agent : conda/4.6.14 requests/2.22.0 CPython/3.6.8 Darwin/17.6.0 OSX/10.13.5
UID:GID : 501:20
netrc file : None
offline mode : False
在发布到这里之前,我已经花了几个小时进行谷歌搜索和查找Stack Exchange。我希望获得一些见解,以及任何人对如何解决此问题的任何想法。
答案 0 :(得分:0)
我认为这是一个老问题,但希望它能对其他人有所帮助。正确的导入应该是
from osgeo import gdal
而不是
import gdal