简体   繁体   English

如何在 Mac OS X 上使用或安装 MagickWand?

[英]How to use or install MagickWand on Mac OS X?

I have problem with magickwand and python and Mac OX X.我对 magickwand 和 python 以及 Mac OX X 有疑问。

When I'm importing it I get the error:当我导入它时出现错误:

ImportError: MagickWand shared library not found. You probably had not
installed ImageMagick library. Try to install:   brew install imagemagick

brew install imagemagick Warning: imagemagick-6.8.9-1 already installed

To get Wand working with imagemagick 7:要让 Wand 与 imagemagick 7 一起工作:

brew install imagemagick
echo 'export MAGICK_HOME=/opt/homebrew/opt/imagemagick/' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/imagemagick/bin:$PATH"' >> ~/.zshrc
brew uninstall --force imagemagick

brew install imagemagick@6

echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.bash_profile

brew link imagemagick@6 --force

So, the actual problem is : 所以,实际问题是:

If your Python in not installed using MacPorts, you have to export MAGICK_HOME path as well. 如果未使用MacPorts安装Python,则还必须导出MAGICK_HOME路径。 Because Python that is not installed using MacPorts doesn't look up /opt/local, the default path prefix of MacPorts packages. 因为未使用MacPorts安装的Python不查找/ opt / local,所以MacPorts包的默认路径前缀。

from wand doc 来自魔杖doc

And the solution they provide is : 他们提供的解决方案是:

$ export MAGICK_HOME=/opt/local $ export MAGICK_HOME = / opt / local

Based on Gowtham's & jrjc's answers, here's how I got the Wand python package to work using homebrew: 基于Gowtham和jrjc的答案,这里是我如何使用自制软件使用Wand python包:

brew install imagemagick@6

echo 'export MAGICK_HOME=/usr/local/opt/imagemagick@6/' >> ~/.bash_profile

There's a few things to note here: 这里有几点需要注意:

  • wand at the time of this writing doesn't yet support imagemagick 7, see https://github.com/dahlia/wand/issues/316 . 撰写本文时,魔杖还不支持imagemagick 7,请参阅https://github.com/dahlia/wand/issues/316
  • MAGICK_HOME seems to be the better way to set the variable - it's mentioned in the wand docs as jrjr's answer mentioned, and if you're really curious you can see how Wand looks for things in api.py under the library_paths method. MAGICK_HOME似乎是设置变量的更好方法 - 它在魔杖文档中被提及为jrjr的答案,如果你真的很好奇,你可以看到Wand在library_paths方法下如何在api.py中查找内容。 I couldn't get Gowtham's approach of exporting the bin directory to work. 我无法得到Gowtham导出bin目录的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM