【问题标题】:checking for ImageMagick version >= 6.4.9... no Can't install RMagick 2.13.4. You must have ImageMagick 6.4.9 or later检查 ImageMagick 版本 >= 6.4.9... 否 无法安装 RMagick 2.13.4。您必须拥有 ImageMagick 6.4.9 或更高版本
【发布时间】:2015-02-22 18:14:12
【问题描述】:

我在安装 rmagick 时遇到问题。我正在使用 ruby​​ on rails 框架开发我的项目。我在我的 gemfile 中包含了 rmagick gem。我收到以下错误消息:

checking for ImageMagick version >= 6.4.9... no
Can't install RMagick 2.13.4. You must have ImageMagick 6.4.9 or later.

我已经使用 brew 安装了 imagemagick:

 imagemagick-6.8.9-8 already installed

imagemagick 文件夹位于 /usr/local/Cellar 目录中

在我的终端中:

Zoulfias-iMac:Myapp zoulfiahall$ rvm 使用 ruby​​-2.0.0-p481

Using /Users/zoulfiahall/.rvm/gems/ruby-2.0.0-p481
Zoulfias-iMac:Myapp zoulfiahall$ sudo gem install rmagick

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

/Users/zoulfiahall/.rvm/rubies/ruby-2.0.0-p481/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/clang... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... no
Can't install RMagick 2.13.4. You must have ImageMagick 6.4.9 or later.

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/zoulfiahall/.rvm/rubies/ruby-2.0.0-p481/bin/ruby

extconf failed, exit code 1

Gem files will remain installed in /Users/zoulfiahall/.rvm/rubies/
ruby-2.0.0-  p481/lib/ruby/gems/2.0.0/gems/rmagick-2.13.4 for inspection.
Results logged to /Users/zoulfiahall/.rvm/rubies/
ruby-2.0.0-  p481/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-13/
2.0.0-static/rmagick-2.13.4/gem_make.out

任何建议将不胜感激。

【问题讨论】:

    标签: imagemagick rmagick


    【解决方案1】:

    这解决了我在 MacOS 10.14 Mojave 中的问题

    brew install pkg-config
    PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick@6/6.9.11-0/lib/pkgconfig gem install rmagick -v 2.16.0
    

    【讨论】:

      【解决方案2】:

      如果你用 brew install imagemagick@6 安装了 imagemagick

      在安装包之前,运行:

      export LDFLAGS="-L/usr/local/opt/imagemagick@6/lib"
      export CPPFLAGS="-I/usr/local/opt/imagemagick@6/include"
      export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"
      

      【讨论】:

        【解决方案3】:

        我在 macOS 上尝试运行 gem install rmagick -v 2.13.4 时遇到了同样的问题

        解决这个问题的诀窍是 rmagick 安装程序 (gems/rmagick-2.13.4/ext/RMagick/extconf.rb) 检查convert 的输出以确定 IM 版本。如果那没有返回正确的版本(或者完全损坏,就像我的情况一样),rmagick 将不会安装。

        我通过 Homebrew 安装了 ImageMagick 6,这解决了我的问题。这个 sn-p 安装 IM,将其添加到您的路径,并运行显式指向 IM6 的安装程序。

        $ brew install imagemagick@6
        $ echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.bash_profile
        $ source ~/.bash_profile
        $ PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick -v 2.13.4
        

        祝你好运!

        【讨论】:

          【解决方案4】:
          brew uninstall pkg-config
          brew install pkg-config
          brew unlink pkg-config
          brew link pig-config
          
          sudo gem install rmagick
          

          这对我有用。

          【讨论】:

            【解决方案5】:

            这在 ubuntu 上对我有用。

            $ sudo apt-get install imagemagick
            $ sudo apt-get install libmagickwand-dev
            

            现在再试一次。

            $ bundle install
            

            【讨论】:

            • 感谢您发布此信息。它可以工作,但我还需要使用命令#apt install ruby-rmagick 安装 ruby​​-rmagick
            • 如果可能,请尝试说明为什么我们需要安装这些库以正常工作 ImageMagick。在其他情况下也是如此。
            • @RememberWhyYouStarted 我不知道为什么需要它。似乎该库依赖于开发库而不仅仅是生产二进制文件。我不知道为什么,只是它有效。
            【解决方案6】:

            下载并安装http://xquartz.macosforge.org/trac/wiki/X112.7.2

            brew uninstall imagemagick
            brew link xz jpeg freetype    
            brew install imagemagick
            brew link --overwrite imagemagick
            gem install rmagick
            

            https://stackoverflow.com/a/32055126/3563993

            【讨论】:

              【解决方案7】:

              我今天也遇到了同样的问题。 导致问题的原因是rmagick 已过时。 并且 gem 没有定期更新。 我想向那些不介意使用旧版 imagemagick 的人展示我的解决方案。 (我相信最高到6.5.9-10)

              1. 卸载 imagemagick 的所有组件:

                brew uninstall --force imagemagick

              2. 通过在命令末尾添加 -ruby186 来安装旧版本的 imagemagick

                brew install imagemagick-ruby186

              3. 安装 rmagick :)

                gem install rmagick

              4. 享受吧!

              【讨论】:

                【解决方案8】:

                刚刚遇到同样的问题。尝试卸载 imagemagick,然后重新安装:

                brew uninstall --force imagemagick
                brew install imagemagick
                

                然后安装 rmagick。这对我有用。

                【讨论】:

                • 这是这里最简约、最直接的解决方案,对我来说效果很好。我建议其他人在尝试其他之前先尝试这个。
                【解决方案9】:

                我在https://github.com/rmagick/rmagick/issues/126 提交了类似问题的错误报告

                我正在使用 debian sid 运行 crunchbang linux。

                看起来你在 OSX 上。如果您还没有提交错误报告,请考虑提交自己的错误报告。

                【讨论】:

                  猜你喜欢
                  • 2012-08-19
                  • 2016-11-07
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 2011-11-09
                  • 1970-01-01
                  • 2011-07-08
                  • 1970-01-01
                  相关资源
                  最近更新 更多