Ruby-on-rails 突然开始得到“无法运行`Identify`命令。请安装ImageMagick。”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8720994/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 02:34:03  来源:igfitidea点击:

All of a sudden started getting "Could Not Run The `Identify` Command. Please Install ImageMagick."

ruby-on-railsruby-on-rails-3imagemagickrmagick

提问by Jacob

I've had ImageMagick, RMagick, & PaperClip working properly with everything setup including the config Paperclip.options[:command_path]in production.rbfile.

我有ImageMagick的,RMagick,与回形针的一切设置工作正常,包括配置Paperclip.options[:command_path]production.rb文件。

All of a sudden I've started getting the following error:

突然间,我开始收到以下错误:

Could Not Run The `Identify` Command. Please Install ImageMagick.

I've tried everything. I've reinstalled ImageMagick, etc. but no avail.

我什么都试过了。我已经重新安装了 ImageMagick 等,但无济于事。

Any help would be greatly appreciated.

任何帮助将不胜感激。

采纳答案by Cris R

You need to change the files production.rband development.rbwhich are in:

您需要更改文件production.rbdevelopment.rb哪些文件位于:

config/environments:

配置/环境

# Paperclip config:
Paperclip.options[:image_magick_path] = "/opt/ImageMagick/bin"
Paperclip.options[:command_path] = "/opt/ImageMagick/bin"

Just add those two lines just before the last line and restart the server.

只需在最后一行之前添加这两行并重新启动服务器。

In MacOSX system, if you are using another location, just put the right PATH there.

在 MacOSX 系统中,如果您使用其他位置,只需将正确的 PATH 放在那里。

回答by danielgatis

From a terminal, run the following command:

从终端运行以下命令:

sudo apt-get install imagemagick

回答by whyisyoung

You can type

你可以输入

which convertand which identify

which convertwhich identify

to check whether imagemagick is installed properly.

检查 imagemagick 是否安装正确。

In my case, which convertreturns /usr/local/bin/convertbut identify not found.

就我而言,which convert返回/usr/local/bin/convertidentify not found.

I used brew install imagemagickbefore, so I run it again and return imagemagick already installed, it's just not linked.

brew install imagemagick以前用过,所以我再次运行它并返回imagemagick already installed, it's just not linked

Finally got the point, brew link imagemagick(or brew link --overwrite imagemagick)

终于明白了,brew link imagemagick(或brew link --overwrite imagemagick

Don't forget to add the Paperclip.options[:command_path] = "/usr/local/bin/"to your config/environment.rbfile.

不要忘记将Paperclip.options[:command_path] = "/usr/local/bin/"加到您的config/environment.rb文件中。

回答by BilalReffas

For Mac users: just run the command brew install imagemagick.

对于 Mac 用户:只需运行命令brew install imagemagick.

回答by Nemus

I had a same issue. This is what worked for me. From terminal, first:

我有同样的问题。这对我有用。从终端,首先:

sudo apt-get update

Then:

然后:

sudo apt-get install imagemagick

回答by Jan

I had this issue, when I had started rails server from my rubymine ide. It seems it does not load your .zshrc (in my case, could also be valid for .bashrc). So some environment variables that make imagemagick work with dvm were not set. For example:

当我从我的 ruby​​mine ide 启动 rails 服务器时,我遇到了这个问题。它似乎没有加载您的 .zshrc(在我的情况下,也可能对 .bashrc 有效)。所以一些使 imagemagick 与 dvm 一起工作的环境变量没有设置。例如:

export PATH=$HOME/local/imagemagick/bin:$PATH
export LD_LIBRARY_PATH=$HOME/local/imagemagick/lib:$LD_LIBRARY_PATH

Once I restarted from my terminal, the error was gone.

一旦我从终端重新启动,错误就消失了。

回答by balexand

I had the same problem. It was caused by https://github.com/thoughtbot/paperclip/issues/1709

我有同样的问题。这是由https://github.com/thoughtbot/paperclip/issues/1709引起的

回答by vidur punj

For Cent OS users:

对于 Cent OS 用户:

 sudo  yum install ImageMagick ImageMagick-devel

will do the job

会做这份工作