mac installs PostgreSQL as a database
The simplest way is to install Postgres.app. This app comes with the latest version of PostgreSQL and does not need to learn the database server startup and shutdown commands. Once the program is well (don't forget to drag it into the application folder), it will automatically open a PostgreSQL server on port 5432. In the program interface there is a very intimate button ' open psql ', you can automatically open a command line for a client to connect with the server. And it will register you as a superuser on the server with your current MAC username, allowing you to make any modifications and actions in the database immediately.
Connecting and manipulating with PostgreSQL via Python requires installing the psycopg2 Library. You can install it by following the instructions:
$ pip Install PSYCOPG2
There will be an error at this time:
Error:pg_config executable not found. Add the directory containing pg_config to the PATH
Again for help StackOverflow found the answer, PSYCOPG2 in the installation need pg_config this program. This program has actually been installed on the hard drive with Postgres.app, but it has not been added to the path of the system. Here's how to add:
CD ~$ nano. Bash_profile
Then add in Bash_profile, you may need to modify the version number (9.4):
Export path= $PATH:/applications/postgres.app/contents/versions/9.4/bin
After saving the file, reload the bash_profile, and note the space between the two points:
$ . . bash_profile
Confirm that pg_config can be found by the system:
$ which pg_config/applications/postgres.app/contents/versions/9.4/bin/pg_config
And then install PSYCOPG2 again.
$ pip Install PSYCOPG2
Above.
MacOS Development Pgsql Database