我刚刚编译并安装了postgres 9.2.1的一个实例。和python 2.7.3。在OpenSuSE 12.2上,在xeon服务器上运行。然后我下载了pygresql并尝试使用pgdb连接到数据库但是这会崩溃python。这是跟踪:
Retrieving package PyGreSQL-4.0-200.1.2.x86_64 (1/1), 85.0 KiB (402.1 KiB unpacked)
Retrieving: PyGreSQL-4.0-200.1.2.x86_64.rpm ........................................................[done]
Installing: PyGreSQL-4.0-200.1.2 ...................................................................[done]
rikki:~/Downloads # python
Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pgdb
>>> c=pgdb.connect()
Segmentation fault
使用除“”或localhost之外的任何内容或“正常”工作。
rikki:~/Downloads # python
Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pgdb
>>> d=pgdb.connect(host="localhost")
Segmentation fault
rikki:~/Downloads # python
Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pgdb
>>> d=pgdb.connect(host="zzzzzzzzzzzzzzz")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/pgdb.py", line 482, in connect
dbtty, dbuser, dbpasswd)
pg.InternalError: could not translate host name "zzzzzzzzzzzzzzz" to address: Name or service not known
>>>
可访问数据库: rikki:〜/下载#psql -U cw psql(9.2.2) 输入“帮助”以获取帮助。
cw=# select now();
now
------------------------------
2013-05-14 09:08:49.54825-07
(1 row)
cw=#
与此同时,我有一个类似安装的桌面,工作正常。
我的安装应该检查什么?
感谢。
- 编辑 - 尝试使用psycopg2-2.5-py2.7
会产生同样的错误:
>>> con=psycopg2.connect(host="z",db="cw",user="cw")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib64/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: invalid connection option "db"
>>> con=psycopg2.connect(host="localhost",database="cw",user="cw")
Segmentation fault