Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
530 views
in Technique[技术] by (71.8m points)

imagemagick - Python doesn't find MagickWand Libraries (despite correct location?)

I wanted to install the Python ImageMagick API wand and followed this site:

http://docs.wand-py.org/en/latest/guide/install.html#install-imagemagick-on-windows

However, when running a very simple test:

from wand.image import Image

I get the following output:

Traceback (most recent call last):

File "F:PATHTOPython34libsite-packageswandapi.py", line 137, in libraries = load_library()

File "F:PATHTOPython34libsite-packageswandapi.py", line 107, in load_library raise IOError('cannot find library; tried paths: ' + repr(tried_paths))

OSError: cannot find library; tried paths: ['F:PATHTOImageMagick-6.8.9-Q16CORE_RL_wand_.dll', 'F:PATHTOImageMagick-6.8.9-Q16CORE_RL_wand_HDRI.dll', 'F:PATHTOImageMagick-6.8.9-Q16CORE_RL_wand_-Q16.dll', 'F:PATHTOImageMagick-6.8.9-Q16CORE_RL_wand_-Q16HDRI.dll', 'F:PATHTOImageMagick-6.8.9-Q16CORE_RL_wand_-Q8.dll', 'F:PATHTOImageMagick-6.8.9-Q16CORE_RL_wand_-Q8HDRI.dll', 'F:PATHTOImageMagick-6.8.9-Q16CORE_RL_wand_-6.Q16.dll', 'F:PATHTOImageMagick-6.8.9-Q16CORE_RL_wand_-6.Q16HDRI.dll']

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:PATHTOPythonest.py", line 1, in import wand.image

File "F:PATHTOPython34libsite-packageswandimage.py", line 20, in from .api import MagickPixelPacket, libc, libmagick, library

File "F:PATHTOPython34libsite-packageswandapi.py", line 161, in 'Try to install: ' + msg)

ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library. Try to install: http://docs.wand-py.org/en/latest/guide/install.html#install-imagemagick-on-windows

The is though, that the files that were tried to be found (e.g. CORE_RL_wand_.dll) are in the very place that they were not found in. So it seems I set the MAGICK_HOME env. variable correctly.

However (what seems to be displayed incorrectly) the paths to the wand api and to my Python installation are displayed with a single backslash in my commandline, while the paths to the ImageMagick folder are displayed with two of them.

I don't understand why this is the case (the env. variable uses single backslashes as in the linked site) and I don't know whether this is the problem or even related to it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I solved my own problem after THINKING about it ;)

I had the 32bit version of Python and the 64bit version of ImageMagick... after uninstalling ImageMagick and installing the 32bit version everything is fine.

Maybe this helps someone who runs into the same problem and comes here via Google ^^


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...