Ruby on Rails Avatar Paperclip::CommandNotFoundError
我一直在尝试与回形针合作。我已经安装了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,确保 Gemfile 中有 rmagick gem
接下来,从命令行打开 Rails 控制台。
类型:
您应该看到类似的内容
如果您这样做,则采用路径(在本例中为
/usr/bin
),并将Paperclip.options[:command_path]
设置为该路径。如果没有,您需要确保已安装 ImageMagick。对于 OSX,请使用 Homebrew (http://mxcl.github.com/homebrew/) 或 MacPorts。对于 Debian 系统,您需要两个软件包:对于基于 Redhat/rpm 的系统,您可以尝试它们的软件包,但它们相当旧,您可能最好从源代码编译。
如果您已经安装了 ImageMagick,那么您需要确保
convert
命令位于您的路径中。附带说明一下,如果安装了 rmagick gem,那么您应该已经安装了 ImageMagick,您只需要弄清楚它在系统上的位置即可。
First, make sure you have the rmagick gem in your Gemfile
Next, open a rails console from the command line.
type:
You should see something like
If you do, then take the path, in this case
/usr/bin
, and setPaperclip.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: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.
您尝试过安装/使用 rMagic 吗?
have you tried installing/using rMagic?
我使用 Macports for Snow Leopard 的二进制文件安装了 ImageMagick。安装进行得很顺利,但是 Paperclip 没有找到 ImageMagick,并且我遇到了同样的错误。
我将以下内容添加到 config/environments/development.rb:
我重新启动了服务器,一切正常。
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:
I restarted the server and everything works perfectly.