MacOS Development Pgsql Database

Source: Internet
Author: User
Tags postgresql

mac installs PostgreSQL as a database
    1. 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.

    2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.