CentOS5.5上安装psycopg2
来源:互联网 发布:珠宝绘图软件 编辑:程序博客网 时间:2024/06/05 19:36
CentOS5.5上安装psycopg2
准备
接上一篇文章[CentOS5.5上安装Python2.7及ez_setup和pip包],先安装好python2.7和pip。
安装postgresql开发包
CentOS5.5默认的postgresql版本比较低,需要安装高版本的postgresql库。
访问 http://yum.postgresql.org/rpmchart.php, 下载postgresql 9.1的库。
下面几个链接是我下载的版本
- http://yum.postgresql.org/9.1/redhat/rhel-5-x86_64/postgresql91-9.1.19-1PGDG.rhel5.x86_64.rpm
- http://yum.postgresql.org/9.1/redhat/rhel-5-x86_64/postgresql91-libs-9.1.19-1PGDG.rhel5.x86_64.rpm
- http://yum.postgresql.org/9.1/redhat/rhel-5-x86_64/postgresql91-devel-9.1.19-1PGDG.rhel5.x86_64.rpm
$ sudo rpm -ivh postgresql91-libs-9.1.19-1PGDG.rhel5.x86_64.rpm$ sudo rpm -ivh postgresql91-9.1.19-1PGDG.rhel5.x86_64.rpm$ sudo rpm -ivh postgresql91-devel-9.1.19-1PGDG.rhel5.x86_64.rpm
安装psycopg2
此时如果使用下面的命令安装psycopg2,仍然会有编译错误。
$ sudo /opt/python27/bin/pip install
所以,退而求其次,只能安装一个老版本的psycopg2。访问 http://initd.org/psycopg/tarballs/ 找到一个老版本,这里使用2.0.1版本,使用下面命令安装。
$ sudo /opt/python27/bin/pip install http://initd.org/psycopg/tarballs/PSYCOPG-2-0/psycopg2-2.0.1.tar.gz
测试
import psycopg2conn = psycopg2.connect(host="...", database="...", user="...", password="...")cursor = conn.cursor ()cursor.execute ("select * from ...")row = cursor.fetchone ()print rowcursor.close ()conn.close ()
转载请以链接形式标明本文地址
本文地址:http://blog.csdn.net/kongxx/article/details/50633577
0 0
- CentOS5.5上安装psycopg2
- CentOS上安装psycopg2
- centos5.8安装postgresql以及python模块psycopg2
- 4.3. RHEL5.5/CENTOS5.5上安装
- 在CentOS5.5上安装FireFox4
- Centos5.5上vsftpd安装使用
- Oralce11gR2在CentOS5.5上的安装
- 在CentOS5上安装oracle10g
- CentOS5.1 上安装 Oracle10g
- apache安装-centos5.2上
- centos5上安装 svn1.6
- Centos5上源代码安装Ganglia
- 在CentOs5上安装Oracle10g
- CentOS5上安装Oracle11gR2(v3)
- Centos5上源代码安装Ganglia
- 在vmware workstation7上安装centos5.5 linux
- 通过yum在CentOS5.5上安装MySQL5.1
- EJBCA(4.0.1)在CentOS5.5上的安装(一)
- BZOJ 4260: Codechef REBXOR|Trie树
- Arduino接口-week4-Lesson3
- LeetCode-59-Spiral Matrix II(Array)-Medium
- mysql 插入中文乱码解决方案
- 0012-关于tab
- CentOS5.5上安装psycopg2
- iOS开发系列--让你的应用“动”起来
- 高薪行业2016年调薪预估率出炉
- 第三方库
- Mysql分库分表方案
- set character_set_database=utf8;set character_set_server=utf8;
- 人工神经网络的设计与实现(三) BP神经网络
- android contentprovider详解
- 网卡 eth0,eth1,eth2,lo分别代表是什么 意思