【发布时间】:2016-02-06 08:36:03
【问题描述】:
我有一个 virtualenv venv 我在其中安装了 mx-base 和 psycopg2 与 pip:
$ pip freeze | grep "psyco\|mx"
egenix-mx-base==3.2.8
psycopg2==2.6
psycopg2 的基本原理可以工作,但是在使用扩展时,我会遇到如下异常:
Traceback (most recent call last):
File "/my_proj/my_code.py", line 32, in <module>
register_types()
File "/my_proj/my_code.py", line 28, in register_types
psycopg2.extensions.register_type(psycopg2._psycopg.MXDATETIME)
AttributeError: 'module' object has no attribute 'MXDATETIME'
或者:
ulf@kalla:~(0)(venv)$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> #Use mx.DateTime instead of pythons datetime, for compability reasons.
... psycopg2.extensions.register_type(psycopg2._psycopg.MXDATETIME)
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
AttributeError: 'module' object has no attribute 'MXDATETIME'
>>>
psycopg2的安装版本好像缺少mx-support。
我该如何解决这个问题?
【问题讨论】:
标签: python postgresql pip virtualenv psycopg2