gpt4 book ai didi

ruby-on-rails - rails - postgres 错误 : Reason: Incompatible library version: libpq. 5.dylib 需要 1.0.0 或更高版本,

转载 作者:数据小太阳 更新时间:2023-10-29 06:49:41 26 4
gpt4 key购买 nike

我无法在我的 Mac (10.6.8) 上设置 Ruby (1.9.3)、Rails 和 Postgres (9.0.8)。每次运行 rails console 时,我都会收到以下错误:

/Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/pg-0.13.2/lib/pg.rb:4:in `require': dlopen(/Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/pg-0.13.2/lib/pg_ext.bundle, 9): Library not loaded: @loader_path/../lib/libssl.dylib (LoadError)
Referenced from: /usr/lib/libpq.5.dylib
Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later, but libssl.0.9.8.dylib provides version 0.9.8 - /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/pg-0.13.2/lib/pg_ext.bundle
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/pg-0.13.2/lib/pg.rb:4:in `<top (required)>'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `require'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `each'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `block in require'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
from /Users/dc/Documents/Aptana Studio 3 Workspace/http/config/application.rb:7:in `<top (required)>'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/railties-3.2.6/lib/rails/commands.rb:39:in `require'
from /Users/dc/.rvm/gems/ruby-1.9.3-head@global/gems/railties-3.2.6/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

我真的不知道如何解决这个问题。我已经尝试安装不同的 Postgres 版本,但我仍然遇到同样的错误。

最佳答案

我也遇到过这个问题,但能够按照 python pip install psycopg2 install error 上的说明修复它.

首先,确保您拥有 most recent version of OpenSSL安装:

MacBook Pro:~> openssl version -a
OpenSSL 1.0.0c 2 Dec 2010
built on: Mon Jan 3 17:26:21 PST 2011
platform: darwin64-x86_64-cc
options: bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: /usr/bin/gcc-4.2 -fPIC -fno-common -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall
OPENSSLDIR: "/opt/local/etc/openssl"

...并记下 OPENSSLDIR。在我的系统上,它位于/opt/local/,因为我是通过 MacPorts 安装的。我只需要更新/usr/lib/中 libssl.dylib 和 libcrypto.dylib 的符号链接(symbolic link),以便它们指向/opt/local/lib 中的正确版本,而不是 usr/lib 中的旧版本:

MacBook Pro:~> ls -la /usr/lib/libssl.dylib 
lrwxr-xr-x 1 root wheel 33 Aug 17 12:25 /usr/lib/libssl.dylib -> /opt/local/lib/libssl.1.0.0.dylib
MacBook Pro:~> ls -la /usr/lib/libcrypto.dylib
lrwxr-xr-x 1 root wheel 36 Aug 17 12:28 /usr/lib/libcrypto.dylib -> /opt/local/lib/libcrypto.1.0.0.dylib

您可以使用 ln 命令创建链接:

sudo ln -s /path/to/postgres/install/lib/libcrypto.dylib /usr/lib/libcrypto.dylib
sudo ln -s /path/to/postgres/install/lib/libssl.dylib /usr/lib/libssl.dylib

关于ruby-on-rails - rails - postgres 错误 : Reason: Incompatible library version: libpq. 5.dylib 需要 1.0.0 或更高版本,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11127486/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com