我无法在 Windows 上安装 rmagick gem
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4873276/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I can't install rmagick gem on windows
提问by Zakwan
I used ruby 1.9.2 and rails 3.0.3. iam trying to install rmagick gem but when i run bundle install
I got an error tells me:
我使用了 ruby 1.9.2 和 rails 3.0.3。我正在尝试安装 rmagick gem,但是当我运行时bundle install
出现错误告诉我:
Installing rmagick (2.12.1) with native extensions c:/Ruby192/lib/ruby/site_ruby
/1.9.1/rubygems/installer.rb:529:in `rescue in block in build_extensions': ERROR
: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
c:/Ruby192/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... *** 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
--without-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:/Ruby192/bin/ruby
c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to genera
te an executable file. (RuntimeError)
You have to install development tools first.
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postp
one'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:171:in `<main>'
Gem files will remain installed in c:/Ruby192/lib/ruby/gems/1.9.1/gems/rmagick-2
.12.1 for inspection.
Results logged to c:/Ruby192/lib/ruby/gems/1.9.1/gems/rmagick-2.12.1/ext/RMagick
/gem_make.out
from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:507:in `b
lock in build_extensions'
from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `e
ach'
from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `b
uild_extensions'
from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:156:in `i
nstall'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/sour
ce.rb:96:in `install'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/inst
aller.rb:55:in `block in run'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/spec
_set.rb:12:in `block in each'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/spec
_set.rb:12:in `each'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/spec
_set.rb:12:in `each'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/inst
aller.rb:44:in `run'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/inst
aller.rb:8:in `install'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/cli.
rb:226:in `install'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/vend
or/thor/task.rb:22:in `run'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/vend
or/thor/invocation.rb:118:in `invoke_task'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/vend
or/thor.rb:246:in `dispatch'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/lib/bundler/vend
or/thor/base.rb:389:in `start'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.10/bin/bundle:13:in
`<top (required)>'
from c:/Ruby192/bin/bundle:19:in `load'
from c:/Ruby192/bin/bundle:19:in `<main>'
I installed ruby from http://rubyinstaller.org/downloads/with development kit and the latest version of ImageMagick. I tried to set rmagick configurations (lib and include directories) but I still get the same error
我从http://rubyinstaller.org/downloads/安装了带有开发工具包和最新版本 ImageMagick 的ruby 。我尝试设置 rmagick 配置(lib 和包含目录)但我仍然遇到相同的错误
any help? any thoughts to solve the issue?
有什么帮助吗?有什么想法可以解决这个问题吗?
回答by shoobm
Prerequisites:
Ruby > 1.8.6
DevKit (any version)
No other ImageMagick installation or PATH entry
先决条件:
Ruby > 1.8.6
DevKit(任何版本)
没有其他 ImageMagick 安装或 PATH 条目
Step 1: Installing ImageMagick:
第 1 步:安装 ImageMagick:
Download ImageMagick: http://imagemagick.spd.co.il/binaries/ImageMagick-6.8.0-3-Q16-windows-dll.exe
下载 ImageMagick:http: //imagemagick.spd.co.il/binaries/ImageMagick-6.8.0-3-Q16-windows-dll.exe
Install ImageMagick:
*Important: The installation path should NOT contain any spaces.
Ideally select “C:\ImageMagick″
安装 ImageMagick:
*重要:安装路径不应包含任何空格。
理想情况下选择“C:\ImageMagick”
Please make sure to select the below options:
请确保选择以下选项:
Add application directory to your path system
Install development headers and libraries for C and C++
将应用程序目录添加到您的路径系统
安装 C 和 C++ 的开发头文件和库
Step 2: Installing rmagick:
第 2 步:安装 rmagick:
Use the following command to install rmagick gem:
使用以下命令安装 rmagick gem:
gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include
via-
通过-
http://shoobm.wordpress.com/2013/01/03/installing-rmagick-gem-on-windows-7/
http://shobm.wordpress.com/2013/01/03/installing-rmagick-gem-on-windows-7/
回答by bmalets
I have the same problem, my environment was:
我有同样的问题,我的环境是:
windows XP (x32)
ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
DevKit-tdm-32-4.5.2-20111229-1559-sfx
ImageMagick-6.8.8-2-Q8-x64-static.exe
I install rmagik gem successfully, after reinstalling of ImageMagick from v6.8.8 to 6.6.7. It was just a problem of incompatibility versions...
在将 ImageMagick 从 v6.8.8 重新安装到 6.6.7 后,我成功安装了 rmagik gem。就是版本不兼容的问题...
回答by Prasanth Louis
First of all clear your path environment variables. (This is the main step that people often skip, but very important). This is the main reason for the error you're facing.
首先清除您的路径环境变量。(这是人们经常跳过的主要步骤,但非常重要)。这是您面临的错误的主要原因。
Then install the rails installer (2.0.0) from here : http://railsinstaller.org/en
然后从这里安装 rails 安装程序(2.0.0):http: //railsinstaller.org/en
It'll set up ruby, rails, and everything else you need. This will also set up your environment path variables for you as well.
它将设置 ruby、rails 以及您需要的所有其他内容。这也将为您设置环境路径变量。
Next install imagemagick 6.7.9.9 or lower and while installing check the option to include C headers. Make sure you install it within the rails installer folder.
接下来安装 imagemagick 6.7.9.9 或更低版本,并在安装时选中包含 C 头文件的选项。确保将其安装在 rails 安装程序文件夹中。
Then type this in your command prompt path=c:\RailsInstaller\ImageMagick-6.7.9-Q8;%path%
or whatever version you have.
然后在您的命令提示符path=c:\RailsInstaller\ImageMagick-6.7.9-Q8;%path%
或您拥有的任何版本中键入它 。
Then type
然后输入
gem install rmagick -- '--with-opt-dir="c:\RailsInstaller\ImageMagick-6.7.9-Q8"'
Finally edit C:\RailsInstaller\Ruby2.0.0\setup_environment.bat to include the path to ImageMagic
最后编辑 C:\RailsInstaller\Ruby2.0.0\setup_environment.bat 以包含 ImageMagic 的路径
At line 25: SET PATH=c:\RailsInstaller\ImageMagick-6.7.9-Q8;
or whatever version you have
在第 25 行:SET PATH=c:\RailsInstaller\ImageMagick-6.7.9-Q8;
或您拥有的任何版本
回答by intellidiot
Use rmagick-win32gem, and it doesn't need ImageMagick separately. This is bundled.
使用rmagick-win32gem,它不需要单独使用 ImageMagick。这是捆绑的。
please have a look: http://rmagick.rubyforge.org/install-faq.html#win
回答by Luis Lavena
Please refer to this threadin RubyInstaller group that points to our Tutorials pagewhere you can find this blog postdescribing the installation method.