突然开始“无法运行“Identify”命令。请安装ImageMagick。”

时间:2022-05-03 09:00:24

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

我已经让ImageMagick、RMagick和PaperClip正常工作,包括配置PaperClip。在生产中选择[:command_path]。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.

非常感谢您的帮助。

7 个解决方案

#1


16  

You need to change the files production.rb and development.rb which are in:

您需要更改文件生成。rb和发展。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系统中,如果您正在使用另一个位置,只需在那里放置正确的路径。

#2


27  

From a terminal, run the following command:

从终端运行以下命令:

sudo apt-get install imagemagick

#3


11  

You can type

你可以输入

which convert and which identify

哪个转换和哪个识别?

to check whether imagemagick is installed properly.

检查imagemagick是否安装正确。

In my case, which convert returns /usr/local/bin/convert but identify not found.

在我的例子中,它转换返回/usr/local/bin/convert,但标识未找到。

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

我之前使用了brew install imagemagick,所以我再次运行它并返回已经安装的imagemagick,它只是没有链接。

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.rb file.

别忘了加回形针。选项[:command_path] = "/usr/local/bin/"到配置/环境。rb文件。

#4


7  

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

对于Mac用户:运行命令brew安装imagemagick。

#5


5  

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:

当我从rubymine 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.

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

#6


5  

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

我也有同样的问题。这对我起了作用。从终端,第一:

sudo apt-get update

Then:

然后:

sudo apt-get install imagemagick

#7


2  

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

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

#1


16  

You need to change the files production.rb and development.rb which are in:

您需要更改文件生成。rb和发展。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系统中,如果您正在使用另一个位置,只需在那里放置正确的路径。

#2


27  

From a terminal, run the following command:

从终端运行以下命令:

sudo apt-get install imagemagick

#3


11  

You can type

你可以输入

which convert and which identify

哪个转换和哪个识别?

to check whether imagemagick is installed properly.

检查imagemagick是否安装正确。

In my case, which convert returns /usr/local/bin/convert but identify not found.

在我的例子中,它转换返回/usr/local/bin/convert,但标识未找到。

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

我之前使用了brew install imagemagick,所以我再次运行它并返回已经安装的imagemagick,它只是没有链接。

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.rb file.

别忘了加回形针。选项[:command_path] = "/usr/local/bin/"到配置/环境。rb文件。

#4


7  

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

对于Mac用户:运行命令brew安装imagemagick。

#5


5  

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:

当我从rubymine 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.

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

#6


5  

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

我也有同样的问题。这对我起了作用。从终端,第一:

sudo apt-get update

Then:

然后:

sudo apt-get install imagemagick

#7


2  

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

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