Forked from iraquitan/mac-brew-python3-postgresql-psycopg2
Created
July 17, 2019 22:13
-
-
Save mitrofun/8673175681b765021af14e821be7ef0c to your computer and use it in GitHub Desktop.
PostgreSQL and psycopg2 initial setup on Mac with Homebrew and Python 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install homebrew | |
| /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| # install postgresql | |
| brew install postgresql | |
| # start homebrew postgresql service | |
| brew service start postgresql | |
| # create a database with your username | |
| createdb `whoami` | |
| # test postgresql by running | |
| psql -h localhost | |
| # to exit psql prompt type | |
| \q | |
| # install python 3 | |
| brew install python3 | |
| # intall virtualenv | |
| pip3 install virtualenv | |
| # create virtualenv with python3 as base | |
| virtualenv -p /usr/local/bin/python3 .virtualenvs/psql-env | |
| # activate psql-env virtualenv | |
| source .virtualenvs/psql-env/bin/activate | |
| # update wheel, setuptools and pip | |
| pip install --update pip | |
| pip install --update wheel | |
| pip install --update setuptools | |
| # install psycopg2 | |
| pip install psycopg2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment