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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
首先也是最重要的是,在报告问题或寻求帮助时,始终包含有关您尝试安装的版本信息,特别是 Ruby。
看来您正在使用 RailsInstaller 进行安装,但由于您没有提及是 2.0 预览版还是稳定版,所以我假设您使用的是稳定版,它基于 Ruby 1.8.7-p334。
现在,RailsInstaller 已经包含了所需的部分:Ruby 和 RubyInstaller DevKit 组件,因此将跳过有关安装的步骤并直接跳转到 RMagick 本身。
要成功安装 RMagick gem,您需要带有开发标头的 ImageMagick 二进制文件,如 RubyInstaller 的教程 wiki 页面中所述,链接此处
请下载32位版本的ImageMagick,因为Ruby是32位的。
对于我的测试,我下载了安装程序版本
ImageMagick-6.7.0-8-Q16-windows-dll.exe
一旦下载并安装在没有空格的路径中,我已选择选项安装 C 和 C++ 的开发头文件和库。
然后打开一个新的命令提示符,确保 Ruby 可用(使用 ruby -v 检查),然后执行以下命令:
该命令将花费相当长的时间(在我的 Core 2 上花费了 1 分钟) Duo),但最终结果是:
现在您可以使用 IRB 验证 RMagick 安装是否成功:
现在,如果您使用 Ruby 1.9.2,则最新的 RMagick 版本与其不兼容,您将需要从源代码构建。 RubyInstaller wiki 上有另一个教程介绍了这一点,但请阅读 RubyInstaller 小组的这个帖子我们讨论这些问题。
希望这一切有帮助。
First and most important, when reporting issues or asking for help, always include version information about what you're trying to install, specially Ruby.
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.
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.
To successfully install RMagick gem, you need ImageMagick binaries with development headers, as documented in RubyInstaller's Tutorial wiki page, which links here
Please download 32bits version of ImageMagick, as Ruby is 32bits.
For my test I've downloaded the installer version
ImageMagick-6.7.0-8-Q16-windows-dll.exe
Once downloaded and installed in a path without spaces and I've selected the option Install development headers and libraries for C and C++.
Then open a new Command Prompt, ensure Ruby is available (checking with
ruby -v
) and after performed the following command:That command is going to take considerable amount of time (took 1 minute on my Core 2 Duo) but the end result was:
Now you can verify RMagick installed successfully using IRB:
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.
上面的这篇文章对我来说不起作用,对我来说关键是使用 GitBash,它附带 RailsInstaller,并且还包括 Devkit。
安装railsinstaller -> www.railsinstaller.org (我将其安装到 c:\Rails)
安装 ImageMagick -> ImageMagick-6.7.3-8-Q16 -windows-dll.exe(我将其安装到c:\ImageMagick)
打开 GitBash
另外,在 gemfile 中,我在开发组中注释掉了 gem 'rmagick'
这就是我的 gemfile 的样子
This above post did not work for me, the key for me was using GitBash wich comes with RailsInstaller, and also includes Devkit.
Install railsinstaller -> www.railsinstaller.org (I installed it to c:\Rails)
Install ImageMagick -> ImageMagick-6.7.3-8-Q16-windows-dll.exe (I installed it to c:\ImageMagick)
Open GitBash
Also, in the gemfile I have commented out gem 'rmagick' in the development group
This is what my gemfile looks like
我们刚刚在 Windows 7、Ruby 2.0 和 Ruby 2.0 上遇到了这个问题。 Rails 4.0
本教程效果非常好:
下载后,安装 ImageMagick文件路径(EG C:/ImageMagick)中没有任何空格,并选中以下选项:
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**
这应该适合你
We just had this problem with Windows 7, Ruby 2.0 & Rails 4.0
This tutorial works really well:
Download the latest ImageMagick installer from ImageMagick.org (as of writing, "[ImageMagick-6.8.7-0-Q16-x86-dll.exe][3]" -- the complete installer (not the binaries))
Once downloaded, install ImageMagick without any white spaces in the file path (E.G C:/ImageMagick) with the following options checked:
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**
This should work for you
我大约一个月前安装了它。我必须克服的许多错误之一是“无效的驱动器规范”,
我刚刚开始写一个博客 post关于基于我的自我回答的问题这里。
但需要注意的是:我使用 ruby 1.9.2,railsinstaller 似乎使用 1.8.7。
如果我没记错的话,这个错误可能是由你的image magick安装路径中的空格引起的。
I did install it about a month ago. One of many errors I had to overcome was the "Invalid drive specification"
I've just started a blog with a post about installing RMagick on Win7 based on my self-answered question here.
One note though: I used ruby 1.9.2 and railsinstaller seem to use 1.8.7.
If I remember it right, this error could be caused by spaces in your image magick installation path.
我没有足够的权限,很抱歉在这里发表对路易斯·拉文纳的回答的评论。
对我有用的一种解决方案是从“使用 Ruby 和 Rails 的命令提示符”(从 Windows 开始菜单)运行 Luis Lavena 的解决方案。它加载所有必要的配置。
I don't have enought privileges, sorry for posting my comment to Luis Lavena's answer here.
One solution that worked for me was running Luis Lavena's solution from "Command Prompt with Ruby and Rails" (from the Windows start menu). It loads all necessary configurations.