Using with Python 3, possible? how?

Поиск
Список
Период
Сортировка
От Leon Starr
Тема Using with Python 3, possible? how?
Дата
Msg-id 3691E4D4-6775-4AEB-919B-F1C97A0D38A6@modelint.com
обсуждение исходный текст
Ответы Re: Using with Python 3, possible? how?  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
Greetings all, newbie here.  I'm trying to use the latest release of psycopg2 with Python3 and having no success so
far.

I'm on Mac OS X Lion (Xcode installed) and I have both 2.7 and 3.2.2 Python installations with 3 set as my default
Python
and these are both macports installations.

So if I fire up my 2.7 IDLE session and do: import psycopg2
it appears to work okay, i.e. no errors.  (And yes, I am sure it's the 2.7 session)

But the same import in a 3.2.2 IDLE session tells me that no such module exists.
Well, duh, of course, because psycopg2 is probably installed in the 2.7 site package
directory.

My two part question is 1) can I use psycopg2 with Python3?  (The psycopg2 home site leads me to believe so)
if so 2) How?  Here's what I've tried so far:
    2a) easy_install would like to install in the 2.7 site install directory, okay, but it's already there, so no
thanks
        (should I try to force it into the 3.x site installation directory somehow?)
    2b) I tried having easy_install load psycopg2 into a separate, empty directory which I put into my PYTHONPATH
        variable, just to see what would happen.  Didn't work.  (See traceback below)
    2c) Should I somehow adjust my package search path in 3.2.2 to look in the 2.7 package directory?
        What could possibly go wrong with that?  ;)

So, should I be doing a, b, c or none of the above?  I eagerly await enlightenment and thank you for your time!

- Leon Starr

(from 3.2.2 IDLE session)
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/starr/SDEV/Python/Site_P3/psycopg2-2.4.5-py2.7-macosx-10.7-x86_64.egg/psycopg2/__init__.py", line 67, in
<module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Users/starr/SDEV/Python/Site_P3/psycopg2-2.4.5-py2.7-macosx-10.7-x86_64.egg/psycopg2/_psycopg.so,
2):Symbol not found: _PyBuffer_Type 
  Referenced from: /Users/starr/SDEV/Python/Site_P3/psycopg2-2.4.5-py2.7-macosx-10.7-x86_64.egg/psycopg2/_psycopg.so
  Expected in: flat namespace
 in /Users/starr/SDEV/Python/Site_P3/psycopg2-2.4.5-py2.7-macosx-10.7-x86_64.egg/psycopg2/_psycopg.so

(It's been a few years since I've written any Python, so I'm a bit groggy on the package installation
procedures, but it's all slowly coming back)


В списке psycopg по дате отправления:

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: Re: dll load fail
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Re: Using with Python 3, possible? how?