0

我刚刚编译并安装了一个 postgres 9.2.1 的实例。和python 2.7.3。在 OpenSuSE 12.2 上,在至强服务器上运行。然后我下载了 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:~/Downloads # psql -U cw psql (9.2.2) 键入“help”以获得帮助。

cw=# select now();  
             now              
------------------------------
 2013-05-14 09:08:49.54825-07
(1 row)

cw=# 

同时,我有一个类似安装的桌面,可以正常工作。

我应该在安装中检查什么?

谢谢。

--EDIT-- 尝试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
4

0 回答 0