{"id":33,"date":"2018-11-12T01:25:07","date_gmt":"2018-11-12T09:25:07","guid":{"rendered":"http:\/\/www.maddog187.com\/?p=33"},"modified":"2018-11-12T01:25:07","modified_gmt":"2018-11-12T09:25:07","slug":"how-to-install-psycopg2-on-linux","status":"publish","type":"post","link":"https:\/\/www.maddog187.com\/index.php\/2018\/11\/12\/how-to-install-psycopg2-on-linux\/","title":{"rendered":"How to install psycopg2 on Linux"},"content":{"rendered":"<p>psycopg2 is a Python module for PostgreSQL. Various PostgreSQL and Python scripts require this. It can be a bit tricky to install. So here is how I was able to install psycopg2 on CentOS 5.x. PIP\/Source installs should be applicable for any Linux OS.<\/p>\n<p><strong>Requirements:<\/strong><br \/>\n\u2013 Postgresql<br \/>\n\u2013 Postqresql-devel<br \/>\n\u2013 Python<\/p>\n<p><strong>YUM Installation:<\/strong><br \/>\nyum install python-psycopg2<\/p>\n<p><strong>Apt-Get Installation:<\/strong><br \/>\napt-get install python-psycopg2<\/p>\n<p><strong>PIP Installation:<\/strong><br \/>\nPIP \u2013 A tool for installing and managing Python packages. This is required and is needed to install Python packages with pip. Clone pip from github:<br \/>\ncd ~<br \/>\nwget https:\/\/raw.github.com\/pypa\/pip\/master\/contrib\/get-pip.py \u2013no-check-certificate<br \/>\npython get-pip.py<\/p>\n<p>Once pip is installed, then locate and export the directory that contains pg-config. X.Y specific to your pgsql install:<br \/>\nlocate pg_config<br \/>\nexport PATH=\/usr\/lib\/postgresql\/X.Y\/bin\/:$PATH<\/p>\n<p>Now to install using pip:<br \/>\npip install psycopg2<\/p>\n<p><strong>Source Installation:<\/strong><br \/>\nLocate and export the directory that contains pg-config. X.Y specific to your pgsql install:<br \/>\nlocate pg_config<br \/>\nexport PATH=\/usr\/lib\/postgresql\/X.Y\/bin\/:$PATH<\/p>\n<p>Now to install psycopg2 via source:<br \/>\ncd ~<br \/>\nwget http:\/\/initd.org\/psycopg\/tarballs\/PSYCOPG-2-5\/psycopg2-2.5.3.tar.gz<br \/>\ntar zxvf psycopg2-2.5.3.tar.gz<br \/>\ncd psycopg2-2.5.3\/<br \/>\npython setup.py install<\/p>\n<p>Please contact me if you have any issues. Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>psycopg2 is a Python module for PostgreSQL. Various PostgreSQL and Python scripts require this. It can be a bit tricky to install. So here is how I was able to install psycopg2 on CentOS 5.x. PIP\/Source installs should be applicable for any Linux OS. Requirements: \u2013 Postgresql \u2013 Postqresql-devel \u2013 Python YUM Installation: yum install [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/posts\/33"}],"collection":[{"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":1,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/posts\/33\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}