[英]Ruby 1.9.2 how to install RMagick on Windows?
I'm currently upgrading an old rails app to use Rails 3 and Ruby 1.9.2, and RMagick is the last gem I need to install.我目前正在升级旧的 rails 应用程序以使用 Rails 3 和 Ruby 1.9.2,而 RMagick 是我需要安装的最后一个 gem。 However there doesn't seem to be any 1.9.2 downloads for Windows and the standard gem install RMagick doesn't work.但是,似乎没有任何适用于 Windows 的 1.9.2 下载,并且标准 gem install RMagick 不起作用。
Could someone point me in the right direction on how to install this gem?有人能指出我如何安装这个 gem 的正确方向吗?
I just installed RMagick 2.13.1 successfully on Windows with Ruby v1.9.x !我刚刚使用 Ruby v1.9.x 在 Windows 上成功安装了 RMagick 2.13.1!
Let me spill out the procedure, before I forget.在我忘记之前,让我把过程说一下。
Set the paths in Environment Variables:在环境变量中设置路径:
set DFImageMagick environment variable to where ImageMagick is installed将 DFImageMagick 环境变量设置为 ImageMagick 的安装位置
set PATH=%DFImageMagick%;%PATH% (if you don't already have it in PATH)设置 PATH=%DFImageMagick%;%PATH% (如果你还没有在 PATH 中)
set CPATH=%DFImageMagick%\\include;%CPATH%设置 CPATH=%DFImageMagick%\\include;%CPATH%
set LIBRARY_PATH=%DFImageMagick%\\lib;%LIBRARY_PATH%设置 LIBRARY_PATH=%DFImageMagick%\\lib;%LIBRARY_PATH%
Install RMagick gem : gem install rmagick安装 RMagick gem: gem install rmagick
This should say, Temporarily enhancing PATH to include DevKit... Building native extensions.这应该说,临时增强 PATH 以包含 DevKit... 构建本机扩展。 This could take a while... After some time, Successfully installed rmagick 2.13.1这可能需要一段时间......一段时间后,成功安装了 rmagick 2.13.1
Verify installation:验证安装:
A. convert -version A. 转换 -version
this should give the ImageMagick installation version这应该给 ImageMagick 安装版本
B. gem list --local should list rmagick 2.13.1 B. gem list --local 应该列出 rmagick 2.13.1
Alternative: in irb, try替代方案:在 irb 中,尝试
require 'rmagick'需要'rmagick'
it should return 'true'它应该返回“真”
Oh, I do like installations which complete in 5 steps.哦,我确实喜欢在 5 个步骤中完成的安装。
Hope this works for you and others.希望这对您和其他人有用。
ref:参考:
http://www.ruby-forum.com/topic/204353#new http://www.ruby-forum.com/topic/204353#new
http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/# link text http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/# 链接文字
After some attempts, this finally worked for me:经过一些尝试,这终于对我有用:
Install DevKit : https://github.com/oneclick/rubyinstaller/wiki/Development-Kit安装 DevKit: https : //github.com/oneclick/rubyinstaller/wiki/Development-Kit
Install ImageMagick (tick yes for headers in the installer) to a folder without spaces in its path (i used C:/ImageMagick)将ImageMagick (安装程序中的标题勾选是)安装到路径中没有空格的文件夹(我使用 C:/ImageMagick)
Open up mingw (msys.bat in DevKit folder) -- and run gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include
(replace the two paths to account for your imagemagick path if needed)打开 mingw(DevKit 文件夹中的 msys.bat) -- 并运行gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include
(如果需要,替换两条路径以说明您的 imagemagick 路径)
I believe there are a few gotchas with RMagick and 1.9, as discussed in this thread at RubyInstaller group.我相信有与RMagick和1.9的几个陷阱,如在讨论这个线程在RubyInstaller组。
However, here you can find a post describing the steps.但是,您可以在此处找到描述这些步骤的帖子。
Other tutorials can be found in our wiki其他教程可以在我们的 wiki 中找到
Hope that helps希望有帮助
Srividya's solution also works with ImageMagick-6.7.0-8-Q16-windows-dll and RMagick 2.13.1. Srividya 的解决方案也适用于 ImageMagick-6.7.0-8-Q16-windows-dll 和 RMagick 2.13.1。
Make sure you are using 32-bit version of ImageMagick if this doesn't work for you on 64-bit version of Windows.如果在 64 位版本的 Windows 上这对您不起作用,请确保您使用的是 32 位版本的 ImageMagick。
I did, and it works.我做到了,而且有效。
This did the trick for me using ruby 2.0:这对我使用 ruby 2.0 起到了作用:
$ gem install rmagick --platform=ruby -- --with-opt-lib=C:/RailsInstaller/ImageMagick-6.7.7-Q8/lib --with-opt-include=c
:/RailsInstaller/ImageMagick-6.7.7-Q8/include
make sure to specify your own version of ImageMagick and the file path you installed it in & include the lib folder on the command确保指定您自己的 ImageMagick 版本和安装它的文件路径,并在命令中包含 lib 文件夹
And tried the following command and it works:并尝试了以下命令并且它有效:
gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.8.6-Q16\lib --with-opt-include=c:\ImageMagick-6.8.6-Q16\include
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.