I installed Imagemagic (both 32 and 64 bits versions were tried) and then used pip to install wand, I also set the Magick_Home env. variable to imagemagic address but when I run
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\Anaconda2\lib\site-packages\wand\image.py", line 20, in <module> from .api import MagickPixelPacket, libc, libmagick, library File "c:\Anaconda2\lib\site-packages\wand\api.py", line 205, in <module> 'Try to install:\n ' + 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
ImageMagick Version 7 is a very recent major release. It'll take some time for the community behind wand (and other bindings) to update core libraries.
For now, you'll have to install the last release of Version 6 (ImageMagick-6.9.8-9-Q16-x64-dll.exe) from http://www.imagemagick.org/download/binaries/
For those on mac and using homebrew, it seems like Wand doesn't support imagemagick 7 yet as mentioned in other answers.
There's a new brew formula for Imagemagick 6 which can be used to install the older version in the meanwhile:
brew install imagemagick@6
Create a symlink to this newly installed dylib file as mentioned in other answer to get things working.
ln -s /usr/local/Cellar/imagemagick@6/<your specific 6 version>/lib/libMagickWand-6.Q16.dylib /usr/local/lib/libMagickWand.dylib
Tested on Sierra and seems to be working fine.
For me on my Mac I had to (found Wand looks for MAGICK_HOME in Wand source):
export MAGICK_HOME="/usr/local/Cellar/imagemagick@6/6.9.9-31"
That was after installing version 6 of imagemagick. I took a look at the Python source for Wand that was installed after I ran pip3 install Wand
. The scripts were looking for imagemagick 6 (I attempted to add 7 into the list of versions it looks for, but got a "wrong version" error).
brew tap homebrew/versions
brew install imagemagick@6
Now, imagemagick version 6 is installed and Wand looks in $MAGICK_HOME
for the libraries.
I have found a solution. The problem is:
Wand try to find a file like that: libMagickWand.dylib in /usr/local/lib/
But if you install ImageMagick with Homebrew, the file generated is libMagickWand-6.Q16.dylib And Wand never find it.
So, you have 2 solutions:
- Create a symbol link from libMagickWand-7.Q16.dylib to libMagickWand.dylib
- You can install by MacPorts or from binaries testing that they create the file.
I have installed the ImageMagick for The Capitan from: http://cactuslab.com/assets/installers/ImageMagick-6.9.1-0.pkg.zip and I declare:
export MAGICK_HOME=/opt/ImageMagick
来源:https://stackoverflow.com/questions/37011291/python-wand-image-is-not-recognized