我终于安装了宝石pg。现在,当我去迁移数据库时,我得到以下内容:
$ rake db:migrate
(in c:/rubyDev/bsbaslic)
rake aborted!
no such file to load -- 1.9/pg_ext
c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.10.0/lib/pg.rb:10:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.10.0/lib/pg.rb:10:in `<top (required)>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:64:in `block (2 levels) in require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:62:in `block in require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/runtime.rb:51:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler.rb:112:in `require'
c:/rubyDev/bsbaslic/config/application.rb:7:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
c:/rubyDev/bsbaslic/Rakefile:4:in `<top (required)>'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
c:/Ruby192/bin/rake:31:in `<main>'
有没有人对它的寻找有什么想法?我在pg.rb所在的目录中有一个pg_ext.so文件。
答案 0 :(得分:1)
Windows程序无法加载.so
个文件 - 而是加载.dll
个文件。您需要为Windows编译的pg
版本,或者您需要在Linys环境(如msys或cygwin)中运行Ruby。
答案 1 :(得分:1)
问题在于你的pg gem版本。 windows pg 0.9.0有一个特殊版本。 为了让它在Windows上工作:
按如下方式安装pg: gem install pg --version = 0.9.0 - --with-pg-config = / short / path / to / postresql / bin (要获得简短路径,您只需将目录更改为PostgrSQL bin,然后在cmd中键入命令,它将自动更改为短路径的路径)
然后编辑您的项目Gemfile以使用正确的pg gem版本(0.9.0)
就是这样。
祝你好运