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

前端 未结 30 1878
深忆病人
深忆病人 2020-11-22 07:47

I am using the Ruby on Rails 3.1 pre version. I like to use PostgreSQL, but the problem is installing the pg gem. It gives me the following error:



        
30条回答
  •  时光取名叫无心
    2020-11-22 08:40

    I had also tried doing gem install libpq-dev, but I received this error:

    Can't find the 'libpq-fe.h header
    *** extconf.rb failed ***
    

    However I found that installing with sudo apt-get (which I try to avoid using with Ruby on Rails) worked, i.e.

    sudo apt-get install libpq-dev
    # or
    apt-get install postgres-server-dev-{pg.version}
    # for postgresql 9.4 on Ubuntu 14.04
    

    then I was able to do

    gem install pg
    

    without issues.

提交回复
热议问题