2015-04-08 152 views
1

我正在学习在windows 8.1上的rails上使用ruby。当我必须安装pg(postgres)gem时,我卡住了。具体而言,这是错误:在windows上的导轨上安装postgres gem时发生错误

错误:错误安装PG:

Error: failed to build gem natve extension 
    C:/Rails Installer/Ruby2.1.0/bin/ruby.exe extconf.rb 
    checking for pg_config... no 
No pg_confg... trying anyway. If build 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. 

我坚持,任何的建议将帮助。由于

+0

您是否尝试过重新安装pg? –

+0

我试过,但我仍然遇到同样的问题...请帮助 –

回答

0

试图找出其中pg_config使用Windows命令行工具位于(来源:https://superuser.com/questions/49104/how-do-i-find-the-location-of-an-executable-in-windows):

where pg_config 

复制的路径返回,并用它

bundle config build.pg --with-pg-config=/path/found/for/pg_config 

(基于ERROR: Failed to build gem native extension on Mavericks

+0

我试图找到pg_config,但结果是:无法找到给定模式的文件,所以我认为我必须重新安装Postgres ...这是一个好主意吗? –

+0

是的,尝试重新安装它 – MrYoshiji

+0

嗨,重新安装后,没有什么改变,你建议我现在做什么? –