在Anaconda中导入gdal错误

时间:2018-04-15 17:19:36

标签: python-3.x anaconda

当我输入<template> <transition name="fade" @after-enter="showContent = true"> <div class="modal" v-if="isVisible"> <transition name="slide"> <div class="modal__content" v-if="showContent"> </div> </transition> </div> </transition> </template> <script> export default { data() { return { isVisible: false, showContent: false }; } }; </script> 时,我明白了:

import gdal

import gdal File "/Users/username/anaconda3/envs/python3/lib/python3.6/site-packages/gdal.py", line 2, in <module> from osgeo.gdal import deprecation_warn File "/Users/username/anaconda3/envs/python3/lib/python3.6/site-packages/osgeo/__init__.py", line 21, in <module> _gdal = swig_import_helper() File "/Users/username/anaconda3/envs/python3/lib/python3.6/site-packages/osgeo/__init__.py", line 17, in swig_import_helper _mod = imp.load_module('_gdal', fp, pathname, description) File "/Users/username/anaconda3/envs/python3/lib/python3.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/Users/username/anaconda3/envs/python3/lib/python3.6/imp.py", line 343, in load_dynamic return _load(spec) ImportError: dlopen(/Users/username/anaconda3/envs/python3/lib/python3.6/site-packages/osgeo/_gdal.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libpoppler.71.dylib Referenced from: /Users/username/anaconda3/envs/python3/lib/libgdal.20.dylib Reason: image not found 返回:

conda list

1 个答案:

答案 0 :(得分:0)

你应该像这样导入

from osgeo import gdal

只是一张纸条。我注意到你正在使用gdal 2.2.2,如果你想要最新版本(2.2.4),你可以从conda-forge下载gdal

conda install -c conda-forge gdal