问题
Good morning,
After a lot of attemps running
from wand.image import Image
I get the following error:
Traceback (most recent call last):
File "C:\Users\XXXXX\PycharmProjects\PDF_convert\venv\lib\site-packages\wand\api.py", line 180, in <module>
libraries = load_library()
File "C:\Users\XXXXX\PycharmProjects\PDF_convert\venv\lib\site-packages\wand\api.py", line 135, in load_library
raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: ['C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWandHDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWandHDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q16.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q16.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q16HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q16HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q16HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q16HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q8.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q8.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q8HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q8HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q8HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q8HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6.Q16.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6.Q16.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6.Q16HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6.Q16HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6.Q16HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6.Q16HDRI-2.dll']
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\xxxxx\PycharmProjects\PDF_convert\venv\lib\site-packages\wand\image.py", line 20, in <module>
from .api import MagickPixelPacket, libc, libmagick, library
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\XXXX\PycharmProjects\PDF_convert\venv\lib\site-packages\wand\api.py", line 206, 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
I have tried everything: 1. Install the most recent binaries ImageMagick-6.9.9-40-Q8-x64-dll (1).exe (checking the required options) 2. Define MAGICK_HOME path as: C:\Program Files\ImageMagick-6.9.9-Q8 3. Restart computer
and still giving me this error.
I'm using windows 10,
Can someone help me with this error? I really need to use this library for scanned ocr pdf.
Thanks in advance!win
回答1:
Refer to this answer here. I had the same problem but I had a 32bit version of Python so I had to download the x86 version of ImageMagick.
回答2:
On windows, installing the 32bit version has worked for me, however, the link on wand's website is dead for some server reason. I have been able to make it work by installing from the binaries list.
http://www.imagemagick.org/download/binaries/ImageMagick-6.9.10-4-Q16-x86-dll.exe
回答3:
Even installing the correct version (32-bit / 64-bit) of ImageMagick 7.X.X, I still got the ImportError: MagickWand shared library not found
error. For my version of Wand==0.4.5
, what helped for me was uninstalling ImageMagick, then installing a 6.9.X version. You may find the list of releases here.
回答4:
For Python v3 (64 bit),
try installing ImageMagick-6.9.10-2-Q16-x64-dll.exe
from here then put installed directory file path in Path environment variable, ex - C:\Program Files\ImageMagick-6.9.10-Q16
then install wand pip install wand==0.4.4
this should fix the issue as there are compatibility issues with wand
and ImageMagick
回答5:
Don't get confused check for correct Python Version:
Not the Windows 32/64bit matters what matters is which Python Verison is installed 32/64bit
To get the correct version:python -VV
>>> Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)]
Find the correct version x64 for 64bit x86 for 32bit Python:
https://imagemagick.org/download/binaries/
Get -dll.exe version...
Note that you have to check Install development headers and libraries for C and C++ to make Wand able to link to it.
Lastly you have to set MAGICK_HOME environment variable to the path of ImageMagick (e.g. C:\Program Files\ImageMagick-6.9.3-Q16). You can set it in Computer ‣ Properties ‣ Advanced system settings ‣ Advanced ‣ Environment Variables….
If you like to convert images like me you need to install Ghostscript in addition:
https://www.ghostscript.com/download/gsdnld.html
来源:https://stackoverflow.com/questions/49894919/importerror-magickwand-shared-library-not-foundwindows