segunda-feira, 13 de março de 2017

How to connect to PostgreSQL using Python

1. Introduction

This post gathers information about configuring Python to connect to PostgreSQL database.

2. Step-by-Step

2.1. Install Python and Pip on SO Base

2.1.1. ONLY FOR CENTOS 7: Install required packages: Python Pip

# yum install epel-release
# cd /tmp
# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# yum -y update
# yum -y install python-pip
# pip install --upgrade pip


2.1.2. ONLY FOR UBUNTU: Install Python 2.7 and Pip

# sudo apt-get update
# sudo apt-get install python2.7
# sudo apt install python-pip
# pip install --upgrade pip


2.2. Install psycopg2

# pip install psycopg2


2.3. Install pygresql

# pip install pygresql



3. Reference




Nenhum comentário:

Postar um comentário