我正在使用Ruby on Rails 3.1预发行版.我喜欢使用PostgreSQL,但问题是安装pggem.它给了我以下错误:
$ gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/u/.rvm/rubies/ruby-1.9.2-p0/bin/ruby 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 …Run Code Online (Sandbox Code Playgroud) postgresql ruby-on-rails pg ruby-on-rails-3 rails-postgresql
我正在尝试为Ruby安装PostgreSQL的pg gem.
我发出了以下命令:
gem install pg
Run Code Online (Sandbox Code Playgroud)
我使用RVM安装了Ruby 1.9.2.
上面的命令显示以下错误.
错误是:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/User/.rvm/rubies/ruby-1.9.2-preview3/bin/ruby extconf.rb
checking for pg_config... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, …Run Code Online (Sandbox Code Playgroud) 我终其一生都无法弄清楚这一点。
当我pip install django-tenant-schemas尝试安装psycopg2需要 Python 头文件和 gcc的依赖项时。我已经安装了所有这些,但仍然不断收到此错误!
./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)
所以要安装libpq-fe-h我需要sudo apt-get install libpq-dev..
..返回..
libpq-dev is already the newest version (10.10-0ubuntu0.18.04.1).
然后当我sudo find / libpq-fe.h似乎不在我的操作系统中时。
我在这一点上迷路了。如果有人可以提供帮助,我将不胜感激。
我试过按照这个答案让宝石工作,但它不会.我的项目设置使得个人项目有自己的宝石而不是生活在全球空间的所有主题宝石,然后我用binstubs它来做我喜欢的事情bin/rails.
因此,.bundle/gems/为每个项目安装所有宝石.总是给我最棘手的问题的是posgresql.让我们完成这些步骤.
所以我跑:
bundle
它爆炸说:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack …Run Code Online (Sandbox Code Playgroud)