ImportError:无法找到OpenSlide dylib。是否安装了OpenSlide?

时间:2019-09-09 11:56:45

标签: python importerror openslide

上下文

问题类型:导入错误
操作系统:Mac OS 10.14.5
OpenSlide Python版本:openslide-python 1.1.1

详细信息

嗨,我已经在Mac OS 10.14.5(在virtualenv环境中)上使用以下命令安装了openslide-python 1.1.1:

pip install openslide-python

在python shell中键入import openslide时遇到此错误:

Traceback (most recent call last):
  File ".../lib/python3.6/site-packages/openslide/lowlevel.py", line 44, in <module>
    _lib = cdll.LoadLibrary('libopenslide.0.dylib')
  File "/anaconda3/lib/python3.6/ctypes/__init__.py", line 426, in LoadLibrary
    return self._dlltype(name)
  File "/anaconda3/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libopenslide.0.dylib, 6): image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../lib/python3.6/site-packages/openslide/__init__.py", line 29, in <module>
    from openslide import lowlevel
  File ".../lib/python3.6/site-packages/openslide/lowlevel.py", line 55, in <module>
    "Is OpenSlide installed?")
ImportError: Couldn't locate OpenSlide dylib.  Is OpenSlide installed?

我去了GitHub代表。 openslide-python中的一个,但我找不到该问题的任何正确答案...

如果有人有答案,那就太好了。
谢谢

1 个答案:

答案 0 :(得分:0)

@Cao Minh Vu解决了这个问题:

要在Mac上使用openslide-python,您需要先安装openslide
为此,请在命令外壳中键入brew install openslide(如果没有安装自制软件,则安装它非常简单快捷。)。
安装openslide后,您可以在命令外壳中键入pip install openslide-python

最终,import openslide将可以正常工作!