postgresql 库未加载:/usr/local/opt/readline/lib/libreadline.6.2.dylib

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21488778/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 00:36:21  来源:igfitidea点击:

Library not loaded: /usr/local/opt/readline/lib/libreadline.6.2.dylib

postgresqlpsqllibreadline

提问by hbejgel

I just installed posgresql with homebrew and when I go on to type the command

我刚刚用自制软件安装了 posgresql,当我继续输入命令时

psql

I get the following error:

我收到以下错误:

dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.2.dylib
Referenced from: /usr/local/bin/psql
Reason: image not found
[1]    69711 trace trap  psql

Does anyone have any idea about what's wrong?

有没有人知道出了什么问题?

回答by dafunkeemonkee

I was getting the exact same error, but the above answers didn't work for me. I had to reinstall postgresql.

我遇到了完全相同的错误,但上述答案对我不起作用。我不得不重新安装 postgresql。

brew reinstall postgresql

brew reinstall postgresql

回答by Stephen

The key problem is that your postgresql was trying to find the libreadline.6.2.dylibbut your readlineis version 7.0, so only 7's lib is linked.

关键问题是你的 postgresql 试图找到libreadline.6.2.dylib但你readline的版本7.0,所以只有 7 的 lib 被链接。

I don't think upgrading postgresql is a good idea, it's not easy and may cause a lot of problem, especially when you already have database data.

我不认为升级 postgresql 是一个好主意,这并不容易并且可能会导致很多问题,尤其是当您已经拥有数据库数据时。

What I do, is to switch the version of readline. When you check brew info readline, you will find different versions, mine is 6.3.8, so I switch to that version by executing:

我所做的是切换readline. 当你检查时brew info readline,你会发现不同的版本,我的是6.3.8,所以我通过执行切换到那个版本:

$ brew switch readline 6.3.8

It will change to 6.3.8 and create the link:

它将更改为 6.3.8 并创建链接:

Cleaning /usr/local/Cellar/readline/6.3.8
Cleaning /usr/local/Cellar/readline/7.0.1
Opt link created for /usr/local/Cellar/readline/6.3.8

In this case, all the linked lib becomes to 6 version, and command line works:

在这种情况下,所有链接的库都变为 6 版本,并且命令行工作:

$ ls /usr/local/opt/readline/lib/
libhistory.6.2.dylib    libhistory.dylib    libreadline.a
libhistory.6.3.dylib    libreadline.6.2.dylib   libreadline.dylib
libhistory.6.dylib  libreadline.6.3.dylib
libhistory.a        libreadline.6.dylib

However, if you have different apps using the different version of readline, I think you should consider upgrading.

但是,如果您有使用不同版本的 readline 的不同应用程序,我认为您应该考虑升级。



Update: 06/02/2019

更新:06/02/2019

What if the old version is not installed?

如果没有安装旧版本怎么办?

Homebrewdoesn't provide a way to install old version formula. And since v2.0.0, it will run brew cleanupas default behaviours every 30 days. Therefore, you may accidentally update brewand delete the old version.

Homebrew不提供安装旧版本公式的方法。从 v2.0.0 开始,它将brew cleanup每 30 天作为默认行为运行一次。因此,您可能会不小心更新brew和删除旧版本。

Here are the steps to install old version:

以下是安装旧版本的步骤:

  1. Go to homebrew-coredirectory:
  1. 进入homebrew-core目录:
    $ cd $(brew --repository)/Library/Taps/homebrew/homebrew-core
  1. Check the hash for old Formula:
  1. 检查旧公式的哈希值:
    $ git log master -- Formula/readline.rb
  1. Find the corresponding version of the hash value
  1. 找到对应版本的hash值
    commit 1dd4221c35716d6bec363ad3425ef93ffe7d9b9f
    Author: BrewTestBot <[email protected]>
    Date:   Wed Aug 15 21:51:16 2018 +0000

        readline: update 7.0.5 bottle.
  1. Checkout to old formula:
  1. 结帐到旧公式:
    $ git checkout 1dd4221c35716d6bec363ad3425ef93ffe7d9b9f Formula/readline.rb
  1. Reinstall the formula:
  1. 重新安装公式:
    $ brew reinstall readline
  1. Reset the repo
  1. 重置回购

Following those steps, you can reinstall the old version of formula.

按照这些步骤,您可以重新安装旧版本的公式。

回答by anvy zhang

If the situation is you have a higher version readline say 7.0. You can do this

如果情况是您有更高版本的 readline,请说 7.0。你可以这样做

cd /usr/local/opt/readline/lib    
ln libreadline.7.0.dylib libreadline.6.2.dylib

回答by Troy

If you don't have readline installed, first install it:

如果您没有安装 readline,请先安装它:

brew install readline

brew install readline

For me, I was getting this error, even though I had readline installed. Reinstalling readline did the trick:

对我来说,即使我安装了 readline,我也收到了这个错误。重新安装 readline 可以解决问题:

brew reinstall readline

回答by sindhu_sp

This worked for me

这对我有用

brew switch readline

This would display the versions you have installed. Pick one out of them. I picked 7.0.5

这将显示您已安装的版本。从其中挑一个。我选择了 7.0.5

I then ran

然后我跑了

brew switch readline 7.0.5

The readline version got updated, and psqlran smoothly.

readline 版本得到更新,并且psql运行顺利。

回答by Jon

this worked for me

这对我有用

ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib

回答by Alex Palcuie

The solution is to force the linking of readline again.

解决方法是再次强制连接readline。

brew remove readline
brew install readline
brew link readline --force

回答by Eugeny Maksimov

It seems to me the problem is about update readline package. postgres tryied to use /usr/local/opt/readline/lib/libreadline.7.dylib in my case. So i just created a symlink to existing version of library /usr/local/opt/readline/lib/libreadline.8.dylib.

在我看来,问题是关于更新 readline 包。在我的情况下,postgres 尝试使用 /usr/local/opt/readline/lib/libreadline.7.dylib 。所以我刚刚创建了一个指向现有版本库 /usr/local/opt/readline/lib/libreadline.8.dylib 的符号链接。

worked for me:

对我来说有效:

ln -s /usr/local/opt/readline/lib/libreadline.8.dylib /usr/local/opt/readline/lib/libreadline.7.dylib

回答by Anthony Dahanne

None of those solutions worked for me; I had to run :

这些解决方案都不适合我;我不得不跑:

brew upgrade bash

from : https://github.com/Homebrew/homebrew-core/issues/5799

来自:https: //github.com/Homebrew/homebrew-core/issues/5799

回答by Mark Pruce

The answer above didn't work for me so I wanted to post what did eventually work. Based on a thread I found here, I had to uninstall readline and the install it again but from source.

上面的答案对我不起作用,所以我想发布最终有效的内容。基于我在这里找到的一个线程,我不得不卸载 readline 并重新安装它,但是从源代码。

brew uninstall readline
brew install --build-from-source readline

After that the psql error went away.

之后 psql 错误消失了。