Notes for installing psycopg2 on Ubuntu

Source: Internet
Author: User

Notes for installing psycopg2 on Ubuntu

Install psycopg2 on Windows and Ubuntu Linux.

Windows:

1. Click here to go to the official website to download the source code

2. Extract

3. Run python setup. py install and report an error.

Solution: the Windows Installation Package is provided on the official website. For details, see here.

In Ubuntu Linux:

1. Go to the official website to download the source code

2. Extract

3. Run python setup. py install and report an error.

4. Run apt-get install psycopg2 directly and report the following error:

Root @ www.bkjia.com :~ # Easy_install psycopg2
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.4
Downloading http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.4.4.tar.gz#md5=639e014ea9ce3aa3306724f12d16d79b
Processing psycopg2-2.4.4.tar.gz
Running psycopg2-2.4.4/setup. py-q bdist_egg -- dist-dir/tmp/easy_install-QddwSA/egg-dist-tmp-RbBPll
Error: You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.

Solution:

Change "psycopg2" to "python-psycopg2 ":

Root @ www.bkjia.com :~ # Apt-get install python-psycopg2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
Python-psycopg2
0 upgraded, 1 newly installed, 0 to remove and 193 not upgraded.
Need to get 630 kB of archives.
After this operation, 2,277 kB of additional disk space will be used.
Get: 1 http://us.archive.ubuntu.com/ubuntu/ oneiric/main python-psycopg2 amd64 2.4.2-1 [630 kB]
Fetched 630 kB in 15 s (41.6 kB/s)
Selecting previusly deselected package python-psycopg2.
(Reading database... 171694 files and directories currently installed .)
Unpacking python-psycopg2 (from.../python-psycopg2_2.4.2-1_amd64.deb )...
Setting up python-psycopg2 (2.4.2-1 )...

Installed successfully

Test:

Root @ www.bkjia.com :~ # Python
Python 2.7.2 + (default, Oct 4 2011, 20:06:09)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> Import psycopg2

Some are normal.

For more information about Ubuntu, see Ubuntu special page http://www.bkjia.com/topicnews.aspx? Tid = 2

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.