我正在尝试安装一个依赖 rmagick 作为 Windows 10 依赖项的 gem。但每次我尝试安装它时,都会出现此错误:
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160126-6648-ks1v6.rb extconf.rb -- with-opt-dir=C:/ImageMagick
*** 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
--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:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
extconf.rb:110:in ``': No such file or directory - identify -version (Errno::ENOENT)
from extconf.rb:110:in `configure_compile_options'
from extconf.rb:16:in `initialize'
from extconf.rb:517:in `new'
from extconf.rb:517:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22- x64/lib/ruby/gems/2.2.0/gems/rmagick-2.15.4 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64- mingw32/2.2.0/rmagick-2.15.4/gem_make.out
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-opt-dir=C:/ImageMagick'
This could take a while...
我什至安装了 gem imagemagick,但它不允许我安装 rmagick。你应该如何在 Windows 10 上安装 rmagick?
最佳答案
您必须使用正确版本的 ImageMagick,并且在安装 gem 时必须引用它:
- Download ImageMagick 6.9.x HDRI Q16 (64bit) ( direct )
- 将其安装到没有空格的路径中
- 在安装 gem 时引用已安装的文件:
这是 gem :
gem install rmagick --platform=ruby -- '--with-opt-dir="[path to ImageMagick]"'
更新
这是一个 good reference
安装步骤如下:
- Download & 安装 ImageMagick
RMagick 的较新版本曾经存在问题;我们安装了 6.9.2
版本,它在 Win10 x64 上运行:
您需要确保勾选了上述两个复选框(C headers
&& system PATH
)。 gem 使用 header 进行编译(可能是您出错的原因); PATH
用于从 cmd 调用 ImageMagick。
您还需要确保...
- 安装路径没有空格
- 您下载
dll
version of ImageMagick (包含 C header ) - 我们得到了 HDRI 版本;没关系
--
- 安装 gem
像 mysql2
等,您需要确保引用已安装的库才能安装 rmagick
:
gem install rmagick --platform=ruby -- --with-opt-lib="c:/path_to_image_magick/lib" --with-opt-include="c:/path_to_image_magick/include"
这可能需要一段时间,但应该安装。
关于ruby-on-rails - 如何在 Windows 10 上安装 rmagick,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35026112/