使用魔杖给出'MagickCompareImagesLayers'找不到错误

时间:2019-09-19 10:43:23

标签: python-3.x imagemagick wand

我正在尝试使用Wand绑定在Python3.7中使用ImageMagick。我已经成功安装了ImageMagick&Wand(pip安装,版本:0.5.7),但是我一直不断收到错误消息:
'AttributeError:function'MagickCompareImagesLayers'not found' b>

我遵循了官方魔杖文件中提到的以下步骤 (link here) !:
1)从官方网站(Windows,64位版本)安装了ImageMagick Binary
2)安装后,将路径添加到名称为'MAGICK_HOME'的系统变量中
3)使用pip安装魔杖

Config:
-platform.attribute()-('64bit','WindowsPE');
-Python3.7.4;
-Wand == 0.5.7;
-ImageMagick-6.9.10-35-Q8-x64-dll

在上述步骤之后运行以下命令:

from wand.image import Image

产生以下错误:

Traceback (most recent call last):

File "", line 1, in from wand.image import Image

File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\image.py", line 18, in from . import assertions

File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\assertions.py", line 125, in from .color import Color # noqa: E402

File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\color.py", line 10, in from .api import library

File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\api.py", line 205, in traceback.format_exc())

ImportError: MagickWand shared library not found or incompatible Original exception was raised in: Traceback (most recent call last): File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\api.py", line 196, in magick_image.load(library, IM_VERSION.value) File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\cdefs\magick_image.py", line 228, in load lib.MagickCompareImagesLayers.argtypes = [c_void_p, c_int] File "c:\users\surya\appdata\local\programs\python\python37\lib\ctypes__init__.py", line 377, in getattr func = self.getitem(name) File "c:\users\surya\appdata\local\programs\python\python37\lib\ctypes__init__.py", line 382, in getitem func = self._FuncPtr((name_or_ordinal, self)) AttributeError: function 'MagickCompareImagesLayers' not found

Getting the following error:

Traceback (most recent call last):

  File "<ipython-input-7-4c9b1a6583e4>", line 1, in <module>
    from wand.image import Image

  File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\image.py", line 18, in <module>
    from . import assertions

  File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\assertions.py", line 125, in <module>
    from .color import Color  # noqa: E402

  File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\color.py", line 10, in <module>
    from .api import library

  File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\api.py", line 205, in <module>
    traceback.format_exc())

ImportError: MagickWand shared library not found or incompatible
Original exception was raised in:
Traceback (most recent call last):
  File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\api.py", line 196, in <module>
    magick_image.load(library, IM_VERSION.value)
  File "c:\users\surya\appdata\local\programs\python\python37\lib\site-packages\wand\cdefs\magick_image.py", line 228, in load
    lib.MagickCompareImagesLayers.argtypes = [c_void_p, c_int]
  File "c:\users\surya\appdata\local\programs\python\python37\lib\ctypes\__init__.py", line 377, in __getattr__
    func = self.__getitem__(name)
  File "c:\users\surya\appdata\local\programs\python\python37\lib\ctypes\__init__.py", line 382, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'MagickCompareImagesLayers' not found

1 个答案:

答案 0 :(得分:0)

通过反复试验解决了该问题。以下步骤对我有用:

1)卸载ImageMagick
2)卸载魔杖
3)安装ImageMagick的6.6-x二进制文件:ImageMagick-6.6.9-10-Q16-windows-x64-dll
(Here's a link with old binaires)
4)安装魔杖(0.5.7)

Voila,现在可以使用。