Ruby on Rails Avatar Paperclip::CommandNotFoundError

发布于 2024-11-03 13:09:02 字数 216 浏览 0 评论 0原文

我一直在尝试与回形针合作。我已经安装了 ImageMagick。我已经添加了这一行 Paperclip.options[:command_path] = config/initializers/paperclip.rb 中的“/usr/local/bin”。

但我仍然收到错误“Avatar Paperclip::CommandNotFoundError”。

我怎样才能解决这个问题?

I've been trying to work with Paperclip. I've installed ImageMagick. I've added the line
Paperclip.options[:command_path] = "/usr/local/bin" in config/initializers/paperclip.rb.

But i'm still getting the error "Avatar Paperclip::CommandNotFoundError".

How can i possibly solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

吲‖鸣 2024-11-10 13:09:02

首先,确保 Gemfile 中有 rmagick gem

gem 'rmagick', :require => 'RMagick'

接下来,从命令行打开 Rails 控制台。

$ rails c

类型:

`which convert`

您应该看到类似的内容

=> "/usr/bin/convert\n"

如果您这样做,则采用路径(在本例中为 /usr/bin),并将 Paperclip.options[:command_path] 设置为该路径。如果没有,您需要确保已安装 ImageMagick。对于 OSX,请使用 Homebrew (http://mxcl.github.com/homebrew/) 或 MacPorts。对于 Debian 系统,您需要两个软件包:

imagemagick
libmagick9-dev

对于基于 Redhat/rpm 的系统,您可以尝试它们的软件包,但它们相当旧,您可能最好从源代码编译。

如果您已经安装了 ImageMagick,那么您需要确保 convert 命令位于您的路径中。

附带说明一下,如果安装了 rmagick gem,那么您应该已经安装了 ImageMagick,您只需要弄清楚它在系统上的位置即可。

First, make sure you have the rmagick gem in your Gemfile

gem 'rmagick', :require => 'RMagick'

Next, open a rails console from the command line.

$ rails c

type:

`which convert`

You should see something like

=> "/usr/bin/convert\n"

If you do, then take the path, in this case /usr/bin, and set Paperclip.options[:command_path] to that path. If you don't, you need to make sure that ImageMagick is installed. For OSX use Homebrew (http://mxcl.github.com/homebrew/) or MacPorts. For Debian systems you'll need two packages:

imagemagick
libmagick9-dev

For Redhat/rpm-based systems, you can try their packages, but they are pretty old and you'll probably be better off compiling from source.

If you've got ImageMagick already installed then you'll need to make sure the convert command is in your path.

As a side note, if the rmagick gem installs, then you should have ImageMagick already installed, you just need to figure out where it is on your system.

浅黛梨妆こ 2024-11-10 13:09:02

您尝试过安装/使用 rMagic 吗?

have you tried installing/using rMagic?

柒夜笙歌凉 2024-11-10 13:09:02

我使用 Macports for Snow Leopard 的二进制文件安装了 ImageMagick。安装进行得很顺利,但是 Paperclip 没有找到 ImageMagick,并且我遇到了同样的错误。

我将以下内容添加到 config/environments/development.rb:

   Paperclip.options[:command_path] = "/opt/local/bin"

我重新启动了服务器,一切正常。

I installed ImageMagick using the Binary from Macports for Snow Leopard. The install went fine, but Paperclip wasn't finding ImageMagick and I was getting the same errors.

I added the following to config/environments/development.rb:

   Paperclip.options[:command_path] = "/opt/local/bin"

I restarted the server and everything works perfectly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文