Windows 7 上的 Ruby on Rails RMagick [英] Ruby on Rails RMagick on Windows 7

查看:36
本文介绍了Windows 7 上的 Ruby on Rails RMagick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我几乎一整天都在尝试在 Windows 7 x64 机器上安装 Rmagick.我已经查看了 Stack Overflow 和其他网站上的每一个教程,但无论我遵循哪个教程,我都会收到无效的驱动器规范"错误.我的环境来自 http://railsinstaller.org/.有没有人最近成功安装了 Rmagick,可以为我指明正确的方向?谢谢,这让我发疯了,但我真的必须让它发挥作用.

Alright, I've been trying to install Rmagick on a Windows 7 x64 machine pretty much all day. I've checked out every single tutorial on Stack Overflow and other sites, but I keep getting an "Invalid Drive Specification" error no matter which tutorial I follow. My environment came from http://railsinstaller.org/. Has anyone successfully installed Rmagick recently that can point me in the right direction? Thanks, this is driving me crazy but I really have to get it working.

推荐答案

首先,也是最重要的一点,在报告问题或寻求帮助时,始终包含有关您要安装的内容的版本信息,特别是红宝石.

First and most important, when reporting issues or asking for help, always include version information about what you're trying to install, specially Ruby.

您似乎正在使用 RailsInstaller 进行安装,但由于您没有提及是 2.0 预览版还是稳定版,我假设您使用的是稳定版,它基于 Ruby 1.8.7-p334.

It seems you're installing using RailsInstaller, but since you didn't mention if is the 2.0 preview version or the stable one, I'll assume you used the stable one, which is based on Ruby 1.8.7-p334.

现在,RailsInstaller 已经包含了所需的部分:Ruby 和 RubyInstaller DevKit 组件,因此将跳过有关安装的步骤并直接跳转到 RMagick 本身.

Now, RailsInstaller already includes the needed pieces: Ruby and RubyInstaller DevKit component, so going to skip the steps about installation of that and jump directly to RMagick itself.

要成功安装 RMagick gem,您需要 ImageMagick 二进制文件 开发标头,如RubyInstaller 中所述教程维基页面,链接这里

To successfully install RMagick gem, you need ImageMagick binaries with development headers, as documented in RubyInstaller's Tutorial wiki page, which links here

请下载32bits版本的ImageMagick,因为Ruby是32bits.

Please download 32bits version of ImageMagick, as Ruby is 32bits.

为了我的测试,我下载了安装程序版本 ImageMagick-6.7.0-8-Q16-windows-dll.exe

For my test I've downloaded the installer version ImageMagick-6.7.0-8-Q16-windows-dll.exe

下载并安装在没有空格的路径中后,我选择了安装 C 和 C++ 的开发头文件和库选项.

Once downloaded and installed in a path without spaces and I've selected the option Install development headers and libraries for C and C++.

然后打开一个新的命令提示符,确保 Ruby 可用(使用 ruby -v 检查),然后执行以下命令:

Then open a new Command Prompt, ensure Ruby is available (checking with ruby -v) and after performed the following command:

gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.7.0-Q16\lib --with-opt-include=C:\ImageMagick-6.7.0-Q16\include

该命令将花费大量时间(在我的 Core 2 Duo 上花费 1 分钟),但最终结果是:

That command is going to take considerable amount of time (took 1 minute on my Core 2 Duo) but the end result was:

Fetching: rmagick-2.13.1.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed

现在您可以使用 IRB 验证 RMagick 是否安装成功:

Now you can verify RMagick installed successfully using IRB:

irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "rmagick"
=> true
irb(main):003:0> Magick::Version
=> "RMagick 2.13.1"

现在,如果您使用的是 Ruby 1.9.2,上一个 RMagick 版本与它不兼容,您将需要从源代码构建.RubyInstaller wiki 上还有另一个教程涵盖了这一点,但请阅读 RubyInstaller 组中的此线程我们讨论这些问题.

Now, if you're using Ruby 1.9.2, last RMagick release is not compatible with it and you will need to build from source. There is another tutorial on RubyInstaller wiki that covers that, but please read this thread at RubyInstaller group were we discuss the issues.

希望所有这些都会有所帮助.

Hope all this helps.

这篇关于Windows 7 上的 Ruby on Rails RMagick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆