Won't Let Me Install Gem in Ruby Prompt

前端 未结 4 1121
小鲜肉
小鲜肉 2021-01-07 08:41

Windows Vista, Ruby v. 3.3.5

C:\\>gem install rmagick

Building native extensions.  This could take a while...

ERROR:  Error installing rmagick:
                 


        
4条回答
  •  再見小時候
    2021-01-07 09:01

    You can get rmagick to compile on Windows with the command:

    gem install rmagick -- '--with-opt-dir="[path to ImageMagick]"'
    

    There are three noteworthy things about this command:

    1. There's a double-dash separating "rmagick" and the --with-opt-dir option
    2. The --with-opt-dir option is surrounded by single-quotes
    3. The path to the ImageMagick directory is surrounded by double-quotes

    You can have spaces in the path to the ImageMagick directory if you use this syntax. I think the path also doesn't care about forward or backward slashes, but I use backslashes.

    You also have to make sure of two other things:

    1. ImageMagick was installed with the development headers option (installs lib and include directories)
    2. ImageMagick is first in your system path

    If ImageMagick isn't first in your system path, you'll get an "Invalid drive specification" error when extconf.rb tries to identify the ImageMagick version.

    All that said, I've experienced failures to build with some version pairings of rmagick and ImageMagick. I was able to get ImageMagick 6.7.7 and rmagick 2.13.1 to build together on both Windows 7 and Server 2003.

提交回复
热议问题