LoginSignup
0
0

More than 1 year has passed since last update.

psycopg2がインストールできない

Last updated at Posted at 2021-06-03

python3.9に上げた後、pip経由で psycopg2 のインストールがハマったので、その備忘録

pip install psycopg2

エラー

Installing collected packages: psycopg2
    Running setup.py install for psycopg2 ... error
    ERROR: Command errored out with exit status 1:
:
中略
:
    ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command '/usr/bin/clang' failed with exit code 1
:
中略
:

解決策

自分は、.bash_profile に追加

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

感想

brew 経由で入れた pyenv をはじめとしたパッケージ(postgresql等)と、その依存関係解決で インストールされた openssl@ 1.1 との相性が悪いのか?

# which openssl
/usr/bin/openssl

opensslのパスが、brewのパッケージのインストール先である

# brew ls openssl
/usr/local/Cellar/openssl@1.1/・・・
:
/usr/local/Cellar/openssl@1.1/・・・

を向いてないのが原因のような・・・
シンボリックリンクが張られている訳でもないし・・・

python環境、久々いじると嵌るww

参考

error installing psycopg2, library not found for -lssl
【小ネタ】Macにpsycopg2をインストールする時のメモ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0