sudo gem install pg无法正常工作 [英] sudo gem install pg won't work
问题描述
我正在尝试让Rails与PostgreSQL一起使用。显然,我需要做的一件事是 sudo gem install pg
。当我这样做时,我得到以下信息:
I'm trying to get Rails to work with PostgreSQL. Apparently one thing I need to do along the way is sudo gem install pg
. When I do that, I get this:
jason@buster:~/projects$ sudo gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:2:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:2
Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.10.0 for inspection.
Results logged to /var/lib/gems/1.8/gems/pg-0.10.0/ext/gem_make.out
我已经搜索过Google,并根据发现的内容尝试了一些方法,但似乎无济于事。有什么建议吗?我在Ubuntu上。
I've Googled and tried a few things based on what I've found but nothing seems to help. Any advice? I'm on Ubuntu.
推荐答案
您需要安装发行版ruby-dev(或devel)软件包,否则您将无法使用能够构建任何ruby C扩展。
You need to install your distro ruby-dev (or devel) package otherwise you won~t be able to build any ruby C extensions.
我不在ubuntu上,但是您的package-manager命令可能有点像这样:
I'm not on ubuntu, but you package-manager command might be somewhat like this:
$ sudo apt-get install ruby-dev build-essential
这篇关于sudo gem install pg无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!