gpt4 book ai didi

python - imoporting GDAL : ImportError, 库未加载时出现问题,找不到图像

转载 作者:太空狗 更新时间:2023-10-30 00:48:21 26 4
gpt4 key购买 nike

从昨天开始,我一直在努力导入一些库,例如 GDAL(或 iris),但我总是得到相同类型的输出。

>>> import gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "gdal.py", line 28, in <module>
_gdal = swig_import_helper()
File "gdal.py", line 24, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: dlopen(./_gdal.so, 2): Library not loaded: @rpath/libicui18n.56.dylib
Referenced from: /Users/zoran/anaconda/lib/libgdal.20.dylib
Reason: image not found

我在我的文件中搜索并发现:

  • 1 个文件包含 libicui18n
  • 2 个文件包含 _gdal.so

    /Users/zoran/anaconda/pkgs/icu-54.1-0/lib/libicui18n.54.1.dylib

    /Users/zoran/anaconda/lib/python2.7/site-packages/osgeo/_gdal.so

    /Library/Frameworks/GDAL.framework/Versions/2.1/Python/2.7/site-packages/osgeo/_gdal.so

今天早上我可以毫无问题地导入 gdal,突然间(我不知道我做了什么)这是完全不可能的。

我尝试过:- 卸载/安装 gdal- 卸载/安装 anaconda 并重新安装 gdal- 创建不同的新环境(在 python2 和 python3 中)并仅安装 gdal

我不知道这个 libicui18n.56.dylib 是什么,neighter libgdal.20.dylib

当我使用上面的路径名称键入 otool -L 时,我得到:

libicui18n.54.dylib (compatibility version 54.0.0, current version 54.1.0)
@loader_path/./libicuuc.54.dylib (compatibility version 54.0.0, current version 54.1.0)
@loader_path/./libicudata.54.dylib (compatibility version 54.0.0, current version 54.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

@rpath/libgdal.1.dylib (compatibility version 20.0.0, current version 20.5.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

/Library/Frameworks/GDAL.framework/Versions/2.1/GDAL (compatibility version 22.0.0, current version 22.1.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

当我输入 conda 信息时:

           platform : osx-64
conda version : 4.2.9
conda is private : False
conda-env version : 4.2.9
conda-build version : 2.0.2
python version : 2.7.12.final.0
requests version : 2.11.1
root environment : /Users/zoran/anaconda (writable)
default environment : /Users/zoran/anaconda
envs directories : /Users/zoran/anaconda/envs
package cache : /Users/zoran/anaconda/pkgs
channel URLs : https://conda.anaconda.org/anaconda/osx-64/
https://conda.anaconda.org/anaconda/noarch/
https://conda.anaconda.org/scitools/osx-64/
https://conda.anaconda.org/scitools/noarch/
https://conda.anaconda.org/conda-forge/osx-64/
https://conda.anaconda.org/conda-forge/noarch/
https://repo.continuum.io/pkgs/free/osx-64/
https://repo.continuum.io/pkgs/free/noarch/
https://repo.continuum.io/pkgs/pro/osx-64/
https://repo.continuum.io/pkgs/pro/noarch/
config file : /Users/zoran/.condarc
offline mode : False

我想知道库是否以某种方式保存在错误的目录中?

我见过很多类似的问题,但没有解决问题的技巧。

感谢帮助

最佳答案

我也遇到了同样的问题。

conda install -f jpeg=8

conda install libgdal

解决我的问题

关于python - imoporting GDAL : ImportError, 库未加载时出现问题,找不到图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40131266/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com