首页 文章

安装rmagick时出错:错误:无法构建gem原生扩展

提问于
浏览
3

我正在尝试使用以下命令安装RmMagic:

gem install rmagick -v=2.12.2

运行此命令后,我收到一些错误:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.


        D:/ruby/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
Invalid drive specification.
Unable to get ImageMagick version
*** 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=D:/ruby/bin/ruby


Gem files will remain installed in D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2
.12.2 for inspection.
Results logged to D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.12.2/ext/RMagick
/gem_make.out

请帮助我这方面 . 提前致谢 .

2 回答

  • 0

    我有同样的问题与rmagick解决这个添加系统环境变量

    CLASSPATH .;C:\ImageMagick-6.5.6-Q8\include
    
    lib C:\ImageMagick-6.5.6-Q8\lib
    

    然后做

    gem install rmagick  --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.5.6-Q8\lib --with-opt-include=C:\ImageMagick-6.5.6-Q8\include
    
  • 2

    这是多么痛苦......我绝对需要同时执行系统环境变量和Mukesh建议的命令的特定语法

    澄清这两个步骤:(对于像我这样的其他新手)

    单击“计算机”上下文菜单中的属性,单击“高级系统设置”,单击“环境变量”,单击“系统变量”下的“新建”,

    使用CLASSPATH作为变量名和值使用:

    .;C:\ImageMagick-6.9.0-Q16\include;lib C:\ImageMagick-6.9.0-Q16\lib

    然后使用Ruby终端以管理员身份运行命令提示符并执行:

    gem install rmagick -v '2.13.4' -- --with-opt-lib=C:\ImageMagick-6.9.0-Q16\lib --with-opt-include=C:\ImageMagick-6.9.0-Q16\include

    (***确保在必要时更新Variable和gem命令中的版本号)

相关问题