0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

psycopg2をインストールするまでにやったこと(とりあえずメモ)

Posted at

pythonとpostgresqlを繋ぐライブラリとしてpsycopgがあるらしいので導入しようとしたが、なかなかインストールに手こずったのでメモ。

最終的にhttps://rikeiblog.com/python-18/ 
を参考に、コマンドラインをダウングレードすることでインストールできた。

pip install psycopg2
pip3 install psycopg2を実行するとエラー
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0d/kn7w1rj50mz8s1lpp6tyng2c0000gt/T/pip-install-2rih1wyp/psycopg2_aa03eb35d88c42c2815696730016a56b/setup.py'"'"'; ....

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install psycopg2
も同じようなエラーが出る

WARNING: You are using pip version 21.1.1; however, version 21.1.2 is available.
You should consider upgrading via the '/usr/local/opt/python@3.9/bin/python3.9 -m pip install --upgrade pip' command.
みたいなことを言われたので素直に従う

/usr/local/opt/python@3.9/bin/python3.9 -m pip install --upgrade pip

もう一度以下を打つがエラー
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install psycopg2

brew install llvm
brew install gcc
をした後にenv LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install psycopg2

エラー文中の
ld: unsupported tapi file type
でググったところhttps://rikeiblog.com/python-18/ 
を見つけコマンドラインをダウングレードすることでインストールできた。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?