Ruby-on-rails ImageMagick / RMagick - 无法安装 RMagick 2.13.1。找不到魔法配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3894225/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 23:21:17  来源:igfitidea点击:

ImageMagick / RMagick - Can't install RMagick 2.13.1. Can't find Magick-config

ruby-on-railsimagemagickrmagick

提问by teecraft

I used a script to install ImageMagick http://github.com/masterkain/ImageMagick-sl

我使用了一个脚本来安装 ImageMagick http://github.com/masterkain/ImageMagick-sl

After a while, I got ImageMagick installed.

过了一会儿,我安装了 ImageMagick。

Then I ran sudo gem install rmagick and got

然后我运行 sudo gem install rmagick 并得到

Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
ERROR: Failed to build gem native extension.

.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in...

I'm working in OSX Snow Leopard with Ruby 1.9.2 and Rails 3. Any ideas?

我正在使用 Ruby 1.9.2 和 Rails 3 的 OSX Snow Leopard 工作。有什么想法吗?

回答by eaykin

I was getting the same error and it got resolved after installing the libmagick9-dev library on ubuntu 11.

我遇到了同样的错误,在 ubuntu 11 上安装 libmagick9-dev 库后它得到了解决。



Update(Thanks to the commenters - Dec. 2012)



更新(感谢评论者 - 2012 年 12 月)

$ sudo apt-get install libmagickwand-devor $ sudo apt-get install graphicsmagick-libmagick-dev-compatfor ubuntu 12

$ sudo apt-get install libmagickwand-dev或者$ sudo apt-get install graphicsmagick-libmagick-dev-compat对于 ubuntu 12

$ sudo apt-get install libmagickwand-devor $ sudo apt-get install libmagick9-devfor ubuntu 11 or below.

$ sudo apt-get install libmagickwand-dev$ sudo apt-get install libmagick9-dev适用于 ubuntu 11 或更低版本。

$ yum install ImageMagick-develfor centos

$ yum install ImageMagick-devel对于centos

$ brew install imagemagickfor Mac OS (using Homebrew)

$ brew install imagemagick适用于 Mac OS(使用 Homebrew)

回答by antiqe

you need the imagemagick libraries under ubuntu

你需要ubuntu下的imagemagick库

$ sudo apt-get install libmagickwand-dev

$ sudo apt-get install libmagickwand-dev

it contains all missing libraires

它包含所有丢失的图书馆

then run bundle installcommand

然后运行bundle install命令

回答by Nic Aitch

I believe you need the Imagemagick libraries.

我相信您需要 Imagemagick 库。

If you are using Homebrew(which I'd highly recommend), simply do

如果您正在使用Homebrew(我强烈推荐),只需执行

$ brew install imagemagick

Then rerun bundle install

然后重新运行 bundle install

回答by Nedudi

Mac OS Mountain Loin (using Homebrew)

Mac OS Mountain Loin(使用 Homebrew)

  1. download and install http://xquartz.macosforge.org/trac/wiki/X112.7.2
  2. brew install imagemagick
  3. gem install rmagick
  1. 下载安装http://xquartz.macosforge.org/trac/wiki/X112.7.2
  2. brew install imagemagick
  3. gem install rmagick

回答by ajayv

sudo apt-get install libmagickwand-dev 

works well for Ubuntu 12.10

适用于 Ubuntu 12.10

This is assuming you have installed all other dependencies viz.

这假设您已经安装了所有其他依赖项,即。

sudo apt-get install imagemagick ruby ruby-dev gem`

回答by fsamuel.bs

For those who got

对于那些得到

InitializeMagick() in -lMagickCore... no; -lMagick... no; -lMagick++... no;

this worked for me in OS X 10.8: https://github.com/maddox/magick-installer

这在 OS X 10.8 中对我有用:https: //github.com/maddox/magick-installer

From here: RVM + Ruby 1.9.2 + Rmagick + Lion = System Works, RVM Doesn't

从这里开始:RVM + Ruby 1.9.2 + Rmagick + Lion = System Works,RVM 不工作

回答by Bjer

On CentOS 5.7, I got it to work by first specifying PKG_CONFIG_PATH:

在 CentOS 5.7 上,我首先指定PKG_CONFIG_PATH

export PKG_CONFIG_PATH=/usr/local/src/ImageMagick-6.7.5-10/magick/

gem install rmagick

回答by David Kim

Initially, I came around to installing rmagick because it seemed to be a dependency when I tried installing libgtk2.0-dev. I was trying to install that package, because the RGtk2.0is a requirement for using R package called rattle.

最初,我开始安装 rmagick,因为当我尝试安装libgtk2.0-dev. 我试图安装该软件包,因为这RGtk2.0是使用名为rattle.

Anyway, none of the above solutions worked for me in installing in my Ubuntu 12.04. Even running sudo apt-get updatefirst didn't seem to help, nor this related posting: Installing rmagick on Ubuntu

无论如何,在我的 Ubuntu 12.04 中安装时,上述解决方案都不适合我。即使sudo apt-get update首先运行似乎也没有帮助,也没有相关的帖子:在 Ubuntu 上安装 rmagick

I eventually found what works is to troubleshoot using sudo aptituderather than apt-get. https://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages

我最终发现使用 sudoaptitude而不是apt-get. https://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages

I recommend the technique of using aptitudeto work through the package installation issue.

我推荐使用的技术aptitude来解决包安装问题。

回答by franksprings

On Mac Os X, check if /opt/local/binis in your PATH. If not:

在 Mac Os X 上,检查是否/opt/local/bin在您的PATH. 如果不:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
sudo gem install rmagick

This worked for me!

这对我有用!

回答by Ben Simpson

I had an issue installing Rmagick gem version 2.13.2 on Debian Jessie. After fighting with the packages in the other answers, I upgraded the version of the Rmagick gem from 2.13.2 to the latest (2.16.0 at time of writing). This installed successfully.

我在 Debian Jessie 上安装 Rmagick gem 2.13.2 版时遇到问题。在与其他答案中的软件包进行斗争后,我将 Rmagick gem 的版本从 2.13.2 升级到最新版本(撰写本文时为 2.16.0)。这样就安装成功了。

bundle update rmagick