使用下面命令安装报错

gem install pg

错误:

[root@AS-test middle_database]# gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/pg-0.18.4/ext
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160413-9383-11d3dx6.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
    --with-pg
    --without-pg
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/pg-0.18.4/mkmf.log

extconf failed, exit code 1

网上搜索了一大片,说是需要安装postgresql-devel这个rpm.

于是安装94版本的:

yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
yum install -y postgresql94-devel-9.4.6  #我主机postgresql 9.4.6的server已安装

然后再次执行上面的命令,还是报错,于是

gem install pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config

接着报错:

ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --with-pg-config=/usr/pgsql-9.4/bin/pg_config

折腾许久,源来需要多加一个 --

gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config

pg gem 安装(postgresql94)的更多相关文章

  1. gem安装cocoapods

    1.升级Ruby环境 sudo gem update --system 如果Ruby没有安装,请参考 如何在Mac OS X上安装 Ruby运行环境 2.安装CocoaPods时我们要访问cocoap ...

  2. gem 安装&卸载pod

    安装: gem 应该是ruby自带的ruby包管理器 sudo gem install cocoapods 卸载: sudo gem uninstall cocoapods

  3. gem 安装nokigiri

    在mac上安装nokogiri的时候各种报错,终于安装成功一次,备份命令. ➜ ~ sudo gem install nokogiri -- --use-system-libraries --with ...

  4. [Phonegap+Sencha Touch] 移动开发34 gem安装compass,不编译scss,怎么办?

    很多人已经发现,今天,该命令 "gem install compass" 安装compass,正在使用 "compass compile" 编scss的时间将报 ...

  5. 使用gem安装jekyll错误记录

    准备在windows7上安装Jekyll, 安装好了Ruby和RubyDevKit之后,准备使用: $ gem install jekyll 安装jekyll,但是返回错误: ERROR: While ...

  6. gem安装redis库时报错

    报错一: [root@Redis-1 software]# /usr/local/ruby/bin/gem install redis-3.2.2.gem ERROR: Loading command ...

  7. gem安装出错了

    1.首先是SSL出错. SSL 证书错误 正常情况下,你是不会遇到 SSL 证书错误的,除非你的 Ruby 安装方式不正确. 如果遇到 SSL 证书问题,你又无法解决,请修改 ~/.gemrc 文件, ...

  8. Can't find the 'libpq-fe.h header when trying to install pg gem

    https://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-p ...

  9. Mac 通过gem安装CocoaPods及Pod的使用

    注:根据http://www.jianshu.com/p/6e5c0f78200a的文章做了部分修改 一.什么是CocoaPods CocoaPods是iOS项目的依赖管理工具,该项目源码在Githu ...

随机推荐

  1. Spring + SpringMVC + Druid + JPA(Hibernate impl) 给你一个稳妥的后端解决方案

    最近手头的工作不太繁重,自己试着倒腾了一套用开源框架组建的 JavaWeb 后端解决方案. 感觉还不错的样子,但实践和项目实战还是有很大的落差,这里只做抛砖引玉之用. 项目 git 地址:https: ...

  2. 如何用TypeScript开发微信小程序

    微信小程序来了!这个号称干掉传统app的玩意儿虽然目前处于内测阶段,不过目前在应用号的官方文档里已经放出了没有内测号也能使用的模拟器了. 工具和文档可以参考官方文档:https://mp.weixin ...

  3. 基于centos的lnmp搭建

    部署lnmp环境 安装配置mariadb配置php配置phpmyadmin配置php-fpm配置nginx配置测试 LNMP(linux,nginx,mariadb,php)部署,以下默认在root权 ...

  4. 两种适用于中小量数据的mysql数据备份

    近来项目的业务量开始大了,感觉如果数据不周期性地备份一下,很可能会出现问题,虽然我每天都有阿里云的自动快照,上网找了一下方法,找到两种相对简单而又适合中小项目或者中小公司的数据备份策略,以下都是数据库 ...

  5. js中的json对象和字符串之间的转化

    字符串转对象(strJSON代表json字符串)   var obj = eval(strJSON);   var obj = strJSON.parseJSON();   var obj = JSO ...

  6. 以.net core重构原有.net framework过程中的一些API变更记录(持续更新)

    1)Type.IsGenericType类似属性变更 以下是.net framework 4.5中Type抽象类中泛型类型的几个个属性,用于泛型类型的相关信息判断: 以下是.net core(nets ...

  7. 一次kubernetes资源文件创建失败的排查

    今天在jenkins中创建kubernetes的rc时,检查目标yaml文件时报出如下错误: + /opt/jenkins/kube/kubectl -s http://10.xx.xx.xx:808 ...

  8. Django初识

    web框架 Web应用框架有助于减轻网页开发时共通性活动的工作负荷,例如许多框架提供数据库访问接口.标准样板以及会话管理等,可提升代码的可再用性.简单地说,就是你用别人搭建好的舞台来做表演,用别人做好 ...

  9. svn报错cleanup failed–previous operation has not finished; run cleanup if it was interrupted的解决办法

    今天在svn提交的时候它卡顿了一下,我以为已经提交完了,就按了一下,结果就再也恢复不了,也继续不了了... 报错 cleanup failed–previous operation has not f ...

  10. ffmpeg视频截图命令

    ffmpeg.exe -i xxx.mp4 -y -f image2 -t 2 -s 64*320 xxx.jpg