sudo gem install pg 不起作用

发布于 2024-10-09 22:00:21 字数 636 浏览 3 评论 0原文

我正在尝试让 Rails 与 PostgreSQL 一起工作。显然,我一路上需要做的一件事是 sudo gem install pg 。当我这样做时,我得到了这个:

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

我已经用谷歌搜索并根据我发现的内容尝试了一些东西,但似乎没有任何帮助。有什么建议吗?我在Ubuntu上。

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

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.

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

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

发布评论

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

评论(2

葬心 2024-10-16 22:00:21

您需要安装发行版 ruby​​-dev(或 devel)包,否则您将无法构建任何 ruby​​ C 扩展。

我不在 ubuntu,但你的包管理器命令可能有点像这样:

$ sudo apt-get install ruby-dev build-essential

You need to install your distro ruby-dev (or devel) package otherwise you won~t be able to build any ruby C extensions.

I'm not on ubuntu, but you package-manager command might be somewhat like this:

$ sudo apt-get install ruby-dev build-essential
撩心不撩汉 2024-10-16 22:00:21

在Ubuntu上:

$ sudo apt-get install postgresql-client libpq5 libpq-dev
$ sudo gem install pg

On Ubuntu:

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