简体   繁体   English

在Windows 7上安装ImageMagick和rmagick

[英]Install ImageMagick and rmagick on Windows 7

I am trying to install ImageMagick and a ruby library binding for it called rmagick onto a windows machine to use with rails + paperclip. 我正在尝试将ImageMagick和一个名为rmagick的红宝石库绑定安装到Windows计算机上,以与rails +回形针配合使用。 I am currently running windows 7. I have set up the rails environment for the windows machine using the rails installer, if that helps. 我当前正在运行Windows7。如果有帮助,我已使用Rails安装程序为Windows机器设置了Rails环境。

I have tried many different resources including these: 我尝试了许多不同的资源,包括:

redmine 管理平台

rmagick wiki 魔幻维基

tutorial 教程

and i am still getting this error 而且我仍然收到此错误

Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-opt-dir="C:\ImageMagick"'
This could take a while...
ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

   current directory: C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rmag
ick-2.16.0/ext/RMagick
C:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20170112-3020-wa31th.rb ex
tconf.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:/RailsInstaller/Ruby2.2.0/bin/$(RUBY_BASE_NAME)
extconf.rb:141:in ``': No such file or directory - identify -version (Errno::ENO
ENT)
        from extconf.rb:141:in `configure_compile_options'
        from extconf.rb:16:in `initialize'
        from extconf.rb:548:in `new'
        from extconf.rb:548:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2
.0/gems/rmagick-2.16.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/extensions/x86
-mingw32/2.2.0/rmagick-2.16.0/gem_make.out

Here is a list of things I have done: 这是我已完成的事情的列表:

  • downloaded the image magick binaries 下载了图像magick二进制文件
  • installed with path option, and set the C and C++ headers 使用path选项安装,并设置C和C ++标头
  • added the proper paths (referred to in the wiki) pointing to the download 添加了指向下载的正确路径(在Wiki中称为)
  • installed the rmagick gem pointing towards the binary download 安装了指向二进制下载的rmagick gem

Has anyone sucessfully installed imagemagick on windows? 是否有人在Windows上成功安装了imagemagick? I may or may not need to use the rmagick gem, as it's just a binding for it, but it seemed like a better option that just the raw download. 我可能需要也可能不需要使用rmagick gem,因为它只是它的绑定,但是与原始下载相比,它似乎是一个更好的选择。

If anyone has successfully accomplished this, I would be very appreciative of any help. 如果有人成功完成了这项工作,我将不胜感激。

It's also worth noting, I am not tied to Paperclip + Imagemagick, if there is another library that works on windows for this I am happy to use that as well. 同样值得注意的是,我并不局限于Paperclip + Imagemagick,如果有另一个可以在Windows上运行的库,我也很乐意使用它。

I have installed it. 我已经安装了。 You will need to install Ruby Devkit. 您将需要安装Ruby Devkit。
https://rubyinstaller.org/downloads/ https://rubyinstaller.org/downloads/

It was very tedious process so I made notes for a client. 这是非常繁琐的过程,所以我为客户做笔记。 Steps are mislabelled because it includes installing git and ruby first. 步骤标签错误,因为其中包括先安装git和ruby。 I would use more recent instructions on websites if available. 如果可以的话,我会在网站上使用更新的说明。

I think that ImageMagick needed to be version 6, not sure. 我认为ImageMagick必须是版本6,不确定。

Here are the notes: 这里是注意事项:

3. Install devkit 3.安装devkit

Same link http://rubyinstaller.org/ 相同链接http://rubyinstaller.org/
Download and extract to C:\\RubyDevkit 下载并解压缩到C:\\ RubyDevkit

Follow steps 3.1 and 3.2 if you downloaded DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe 如果您下载了DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe,请执行步骤3.1和3.2

For other versions, if you are getting error messages then use instructions from http://rubyinstaller.org/ 对于其他版本,如果收到错误消息,请使用http://rubyinstaller.org/中的说明
which used to link to this document: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit 用于链接到此文档的链接: https : //github.com/oneclick/rubyinstaller/wiki/Development-Kit

3.1. 3.1。 Entire DevKit procedure at a glance 整个DevKit过程一目了然
  • Download matching version (from http://rubyinstaller.org/ ) 下载匹配版本(来自http://rubyinstaller.org/
  • Uninstall previous version if it exists. 卸载以前的版本(如果存在)。
  • Extract to C:\\RubyDevKit 提取到C:\\ RubyDevKit

You need to open CMD.exe (do not use git bash) to C:\\RubyDevKit and type these commands. 您需要打开CMD.exe(不要使用git bash)到C:\\ RubyDevKit并键入以下命令。

 cd C:\\RubyDevKit ruby dk.rb init ruby dk.rb install devkitvars.bat 

4. Install imagemagick 4.安装imagemagick

If your ruby is 32 bit, install 32 bit otherwise 64 bit. 如果您的红宝石是32位,请安装32位,否则安装64位。
What works for sure is ImageMagick-6.7.3-4-Q16-windows-dll.exe 可以肯定的是ImageMagick-6.7.3-4-Q16-windows-dll.exe

Don't install in Program Files because 3rd party scripts might have problems with spaces. 不要安装在Program Files因为第3方脚本可能存在空格问题。

Install in C:\\ImageMagick so that you can copy paste commands later 安装在C:\\ImageMagick以便以后可以复制粘贴命令

Make sure these options are checked 确保选中这些选项

  • Add application directory to your system path 将应用程序目录添加到系统路径
  • Install development headers and libraries for C and C++ 安装C和C ++的开发标头和库

5. Install rmagick gem 5.安装rmagick gem

Just running bundle install fails because it requires more options. 仅运行捆绑软件安装失败,因为它需要更多选项。

Run this from anywhere in cmd.exe cmd.exe任何位置运行此文件
To open cmd.exe open Start Menu and under Search programs and files type cmd.exe 要打开cmd.exe打开“开始”菜单,然后在“ Search programs and files键入cmd.exe

echo %LIBRARY_PATH%

Unfortunately these commands give no visual feedback like OK. 不幸的是,这些命令没有像OK这样的视觉反馈。 To get feedback you can type this: 要获取反馈,您可以输入以下内容:

gem install rmagick -- '--with-opt-dir="C:\ImageMagick"'

And you should get output "C:\\ImageMagick\\include" 并且您应该获得输出"C:\\ImageMagick\\include"

gem list

And you should get output "C:\\ImageMagick\\lib" 并且您应该得到输出"C:\\ImageMagick\\lib"

 gem install rmagick -- '--with-opt-dir="C:\\ImageMagick"' 

You should get a success message. 您应该会收到一条成功消息。 You can verify if gem is installed by typing 您可以通过键入以下命令来验证是否已安装gem

 gem list 

It should list rmagick. 它应该列出rmagick。

Try this first, but in case this doesn't work, look up more current instructions on: 请先尝试执行此操作,但如果此操作不起作用,请查看有关以下内容的更多最新说明:
https://github.com/rmagick/rmagick/wiki/Installing-on-Windows https://github.com/rmagick/rmagick/wiki/Installing-on-Windows

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM