psycopg2がインストールできずエラーになる


press
psycopg2がインストールできずエラーになる

psycopg2がインストールできずエラーになる

DjangoでPostgreSQLに接続するために、以下のコマンドでpsycopg2をインストールしたところ、以下のエラーが発生した時の対処法です。

pip install psycopg2

エラー

Collecting psycopg2==2.8.3
  Using cached psycopg2-2.8.3.tar.gz (377 kB)

    ERROR: Command errored out with exit status 1:
     command:

...

    Error: pg_config executable not found.
    
...

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

実際には…の部分にエラー内容が表示されています。

原因は新しい環境で開発をしていたので、PostgreSQL自体のインストールができていないことでした。以下のコマンドでPostgreSQLをインストールすると無事にpsycopg2もインストールできました。

brew install postgresql

株式会社ファントムへのお問い合わせ

群馬県でPythonを使ったAIやソフトウェアを開発している株式会社ファントムが運営しています。




    Show Comments (0)

    Comments

    Related Articles

    Python

    Pythonのdatetimeで日付、時間の計算(1)

    Pythonのdatetimeで日付、時間の計算(1) Pythonには日付や日時を扱うdatetimeモジュールがありますが、日付の取得・計算にはtimedeltaを使います。 開発環境 現在の日付、時刻を取得 日付の […]

    Posted on by press
    Python

    BERT+UMAPを実装した

    https://shuhoyo.hatenablog.com/entry/nogizaka46-lyrics-nlp 上記サイトを参考にBERT+UMAPを実装してみた。 BERTとは BERTとは自然言語処理の1手法の […]

    Posted on by EIGHT