Windows 7 上的 Ruby on Rails RMagick

发布于 2024-11-17 02:43:46 字数 258 浏览 7 评论 0原文

好吧,我几乎一整天都在尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

故乡的云 2024-11-24 02:43:46

首先也是最重要的是,在报告问题或寻求帮助时,始终包含有关您尝试安装的版本信息,特别是 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 检查),然后执行以下命令:

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 上花费了 1 分钟) Duo),但最终结果是:

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 安装是否成功:

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 小组的这个帖子我们讨论这些问题。

希望这一切有帮助。

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:

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

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

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"

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.

迟月 2024-11-24 02:43:46

上面的这篇文章对我来说不起作用,对我来说关键是使用 GitBash,它附带 RailsInstaller,并且还包括 Devkit。

安装railsinstaller -> www.railsinstaller.org (我将其安装到 c:\Rails)
安装 ImageMagick -> ImageMagick-6.7.3-8-Q16 -windows-dll.exe(我将其安装到c:\ImageMagick)

打开 GitBash

$ gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Installing RDoc documentation for rmagick-2.13.1...

另外,在 gemfile 中,我在开发组中注释掉了 gem 'rmagick'

这就是我的 gemfile 的样子

group :development do #this is used on localhost
 gem 'mysql2'
 gem 'paperclip'
 #gem 'rmagick' #dont need this
 gem 'devise'
end

group :production do #this is used on heroku
 gem "pg" #this is postgresql used on heroku
 gem "aws-s3" #this is used for amason S3 filestorage

 gem 'paperclip'
 gem 'rmagick'
 gem 'devise'
end

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

$ gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Installing RDoc documentation for rmagick-2.13.1...

Also, in the gemfile I have commented out gem 'rmagick' in the development group

This is what my gemfile looks like

group :development do #this is used on localhost
 gem 'mysql2'
 gem 'paperclip'
 #gem 'rmagick' #dont need this
 gem 'devise'
end

group :production do #this is used on heroku
 gem "pg" #this is postgresql used on heroku
 gem "aws-s3" #this is used for amason S3 filestorage

 gem 'paperclip'
 gem 'rmagick'
 gem 'devise'
end
十级心震 2024-11-24 02:43:46

我们刚刚在 Windows 7、Ruby 2.0 和 Ruby 2.0 上遇到了这个问题。 Rails 4.0

本教程效果非常好:

  1. < p>下载最新版本来自 ImageMagick.org 的 ImageMagick 安装程序(截至撰写本文时,“[ImageMagick-6.8.7-0-Q16-x86-dll.exe][3]”——完整的安装程序(不是二进制文件))
  2. 下载后,安装 ImageMagick文件路径(EG C:/ImageMagick)中没有任何空格,并选中以下选项:

  • 将应用程序目录添加到系统路径
  • C 和库的安装程序开发标头; C++
  1. 在 Ruby CMD 中,使用正确的文件路径安装 RMagick Gem:

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:

  1. 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))

  2. Once downloaded, install ImageMagick without any white spaces in the file path (E.G C:/ImageMagick) with the following options checked:

  • Add Application Directory To Your System Path
  • Installer Development Headers For Libraries C & C++
  1. In the Ruby CMD, install the RMagick Gem with the correct file paths:

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

挽梦忆笙歌 2024-11-24 02:43:46

我大约一个月前安装了它。我必须克服的许多错误之一是“无效的驱动器规范”,

我刚刚开始写一个博客 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.

喜爱皱眉﹌ 2024-11-24 02:43:46

我没有足够的权限,很抱歉在这里发表对路易斯·拉文纳的回答的评论。

对我有用的一种解决方案是从“使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文