使用下面命令安装报错

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. [LeetCode] Combination Sum 组合之和

    Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wher ...

  2. .NET WebAPI 用ExceptionFilterAttribute实现错误(异常)日志的记录(log4net做写库操作)

    好吧,还是那个社区APP,非管理系统,用户行为日志感觉不是很必要的,但是,错误日志咱还是得记录则个.总不能上线后报bug了让自己手足无措吧,虽然不管有木有错误日志报bug都是件很头疼的事... 我们知 ...

  3. C++知识回顾(二)——名称空间

    随着工程的增大,名称相互冲突的肯能性增加,使用多个厂商的类库时,可能导致名称冲突.为了解决这些问题,需要用到名称空间. 为了将代码加入名称空间,可以使用namespae将其包含,例如,编写一段代码,其 ...

  4. 浅析jquery ajax异步调用方法中不能给全局变量赋值的原因及解决方法(转载)

    在调用一个jquery的ajax方法时我们有时会需要该方法返回一个值或者给某个全局变量赋值,可是我们发现程序执行完后并没有获取到我们想要的值,这时很有可能是因为你用的是ajax的异步调用async:t ...

  5. C#-WebForm-Session、Cookie-登录验证(未登录跳至登录界面)、隐藏地址栏传值

    Post 传值(看不见的传值) Get 传值(看得见的传值) Session - 全局变量组 存放位置:服务端 作用:只要里面有内容,那么这个网站中所有的C#端都能访问到这个变量 -- object类 ...

  6. CodeForces - 453A Little Pony and Expected Maximum

    http://codeforces.com/problemset/problem/453/A 题目大意: 给定一个m面的筛子,求掷n次后,得到的最大的点数的期望 题解 设f[i]表示掷出 <= ...

  7. javascript 基础

    javascript概述: javascript历史: * 1992年Nombas开发出C-minus-minus(C--)的嵌入式脚本语言(最初绑定在CEnvi软件中).后将其改名ScriptEas ...

  8. Android 天猫apk聊天数据库解密

    1.使用Android 天猫apk 进行聊天会产生tmallWangXinDB的数据库.2.用sqlite3 工具打开提示加密或者错误.3.需要对该数据库进行解密. 解密流程:1.反编译apk,dex ...

  9. .net 高效开发实用工具

    Visual Studio Visual Studio Productivity Power tool: VS 专业版的效率工具. Web Essentials: 提高开发效率,能够有效的帮助开发人员 ...

  10. PHP数组函数总结

    array_change_key_case - 返回字符串键名全为小写或大写的数组 array_chunk - 将一个数组分割成多个 array_column - 返回数组中指定的一列 array_c ...