Installing psycopg2 into virtualenv when PostgreSQL is not installed on development system

前端 未结 14 1176
一向
一向 2020-12-04 09:24

Is it possible to install psycopg2 into a virtualenv when PostgreSQL isn\'t installed on my development system—MacBook Pro with OS X 10.6?

When I run

14条回答
  •  孤城傲影
    2020-12-04 09:49

    if you have recently updated python or changed default python (let's say from 3.6 to 3.8). The following code

    sudo apt-get install python-dev   OR    sudo apt-get install python3-dev
    

    will be installing/working for the previous python version.

    so if you want this command to work for the recently updated/changed python version try mentioning that specific version like python3.8 in command like

    sudo apt-get install python3.8-dev  
    

    try above with following

    pip install wheel
    export PATH=/path/to/compiled/postgresql/bin:"$PATH"
    sudo apt-get install libpq-dev
    sudo apt-get install python3.x-dev    **Change x with your version, eg python3.8**
    pip install psycopg2-binary
    pip install psycopg2
    

提交回复
热议问题