在Windows上安装RMagick

我已经对此进行了研究,并且我已经在我的一台计算机上进行了数小时的研究。

我大约3周前在桌面计算机上安装了RMagick,而且相当复杂。

我不记得我采取的确切步骤,我真的很沮丧。

我在目录C:\ ImageMagick中将ImageMagick安装到我的机器上

我也为Ruby安装了开发套件。

我还将rmagick-rmagick-v2-2-g564f157放入我C中的正确gems文件夹中:它位于C:\ Ruby22-x64 \ lib \ ruby​​ \ gems \ 2.2.0 \ gems中

我收到以下错误:

我将输入: gem install rmagick -- '--with-opt-dir="c:\ImageMagick"'

并得到以下错误:

 Temporarily enhancing PATH to include DevKit... Building native extensions with: '--with-opt-dir="c:\ImageMagick"' This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160326-6132-157vnes.rb extconf.rb '--with-opt-dir="c:\ImageMagick" checking for main() in -lCORE_RL_magick_... no searching PATH for the ImageMagick library... checking for main() in -lCORE_RL_magick_... no checking for main() in -lCORE_RL_magick_... no checking for main() in -lCORE_RL_magick_... no Can't install RMagick 2.15.4. Can't find the ImageMagick library. Retry with '--with-opt-dir' option. Usage: gem install rmagick -- '--with-opt-dir="[path to ImageMagick]"' eg gem install rmagick -- '--with-opt-dir="C:Program FilesImageMagick-6.9.1- Q16"' *** 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 --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=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME) --with-CORE_RL_magick_lib --without-CORE_RL_magick_lib --with-CORE_RL_magick_lib --without-CORE_RL_magick_lib --with-CORE_RL_magick_lib --without-CORE_RL_magick_lib --with-CORE_RL_magick_lib --without-CORE_RL_magick_lib extconf failed, exit code 1 Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0 /gems/rmagick-2.15.4 for inspection. Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/rmagick-2.15.4/gem_make.out 

在这一点上我很沮丧。 它在我的台式计算机上运行,​​但在这里不起作用。 有什么建议?

我要做的安装如下:

  1. 使用安装程序安装ImageMagick,包括(!)“开发标题和库”请参阅: http : //www.graphity-consulting.com/files/2016/03/screenshot-installation-imagemagick-6.9.3-32bit-3.png
  2. 打开Windows命令提示符
  3. 增强路径以包含ImageMagick。 例如, set PATH=d:\opt\ImageMagick;%PATH%
  4. 使用以下命令安装gem: gem install rmagick -- --with-opt-dir=d:\opt\ImageMagick

注意:我让gem自己下载rmagick并将路径传递给--with-opt-dir ImageMagick并将其放在我的路径中。

更新:

正如@ winter-young在评论中提到的:不要将32位ruby与64位ImageMagick混合使用,反之亦然。 仅使用32位ruby和32位ImageMagick。 或者使用64位ruby和64位ImageMagick。

更新2

作为@ winter-young州,rmagick 2.15.4只支持ImageMagick 6,而不支持ImageMagick 7(我自己没有测试)

更新3

正如@tiefenauer指出的那样,rmagic 2.16.0适用于ImageMagick 7.0.8。 此外,现在需要单引号: gem install rmagick -- '--with-opt-dir=C:\Program Files\ImageMagick-7.0.8-Q16'

这是一个链接,可以帮助您解决安装rmagick gem时遇到的所有问题。

经过大量浏览后找到它,之后您可能不需要任何其他链接访问。

链接: – https://medium.com/ruby-on-rails-web-application-development/install-rmagick-gem-on-windows-7-8-10-imagemagick-6-9-4-q16-hdri -5492c3fef202

我希望它能节省您的时间和精力