postgresql Libssl 和 libcrypto 导致 dyld:库未加载:/usr/lib/libpq.5.dylib

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13643452/
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-10-21 00:36:05  来源:igfitidea点击:

Libssl and libcrypto causing dyld: Library not loaded: /usr/lib/libpq.5.dylib

pythonpostgresqlpippsycopg2libssl

提问by disappearedng

I recently uninstalled postgresql and installed pyscopg2 via pip.

我最近卸载了 postgresql 并通过 pip 安装了 pyscopg2。

I know there's some trickery involved with libcrypto and libssl

我知道 libcrypto 和 libssl 有一些技巧

Currently i have them symlinked to:

目前我将它们符号链接到:

$ ls -lah libssl.*
-rwxr-xr-x  1 root  wheel   402K Aug 28 11:06 libssl.0.9.7.dylib
-rwxr-xr-x  1 root  wheel   589K Aug 28 11:06 libssl.0.9.8.dylib
lrwxr-xr-x  1 root  wheel    55B Nov 29 23:38 libssl.1.0.0.dylib -> /usr/local/Cellar/openssl/1.0.1c/lib/libssl.1.0.0.dylib
lrwxr-xr-x  1 root  wheel    55B Nov 30 02:25 libssl.dylib -> /usr/local/Cellar/openssl/1.0.1c/lib/libssl.1.0.0.dylib

/usr/lib
$ ls -lah libcrypto.*
-rwxr-xr-x  1 root  wheel   2.1M Aug 28 11:06 libcrypto.0.9.7.dylib
-rwxr-xr-x  1 root  wheel   2.6M Aug 28 11:06 libcrypto.0.9.8.dylib
-r-xr-xr-x  1 root  wheel   1.6M Oct 31 22:12 libcrypto.1.0.0.dylib
lrwxr-xr-x  1 root  wheel    58B Nov 30 02:27 libcrypto.dylib -> /usr/local/Cellar/openssl/1.0.1c/lib/libcrypto.1.0.0.dylib

whereby I installed openssl via ports

我通过端口安装了 openssl

Now when I run arc diff, I am getting the infamous

现在当我运行 arc diff 时,我得到了臭名昭著的

$ arc diff
dyld: Library not loaded: /usr/lib/libpq.5.dylib
  Referenced from: /usr/bin/php
  Reason: image not found
Trace/BPT trap: 5

There are a few answers here in SO which talks about symlinking these libs to the postgresql install directory. Obviously, this won't work for me.

这里有一些答案,其中讨论了将这些库符号链接到 postgresql 安装目录。显然,这对我不起作用。

What should I do?

我该怎么办?

回答by disappearedng

Turns out /usr/lib/libpq.5.dylib was absent but /usr/lib/libpq.5.4.dylib was not.

结果 /usr/lib/libpq.5.dylib 不存在但 /usr/lib/libpq.5.4.dylib 不存在。

sudo ln -s /usr/lib/libpq.5.4.dylib /usr/lib/libpq.5.dylib

fixed the issue.

解决了这个问题。

回答by metasequoia

Not unlike @Pablo Marambio, I fixed this issue by adding the following line to ~/.profile:

与@Pablo Marambio 不同,我通过添加以下行来解决此问题~/.profile

export DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.3/lib:$DYLD_LIBRARY_PATH

For Postgres.app v9.3.5.0 (presumably others too) I added the following line instead:

对于 Postgres.app v9.3.5.0(大概也是其他),我添加了以下行:

export DYLD_LIBRARY_PATH=/Applications/Postgres.app/Contents/Versions/9.3/lib:$DYLD_LIBRARY_PATH

Then, of course, run source ~/.profile

然后,当然,运行 source ~/.profile

回答by SuperNova

To resolve this, I had to uninstall postgresql and then install again.

为了解决这个问题,我不得不卸载 postgresql,然后重新安装。

$ brew uninstall postgresql

$ brew update

$ brew install postgres