Installation of psycopg2
Ryan Schmidt
ryandesign at macports.org
Thu Oct 6 06:22:21 PDT 2011
Remember to Reply All so this discussion remains on the mailing list.
On Oct 6, 2011, at 07:58, David Rippel wrote:
> Hi Ryan,
>
> Thanks for your quick reply!
>
> I seem to be missing something. Maybe you can explain this behavior - why it works with the MacPorts python2.7 and doesn't work with the default python2.7? How can I fix this?
>
> > which python
> /Library/Frameworks/Python.framework/Versions/2.7/bin/python
> > python
> Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import psycopg2
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named psycopg2
> >>>
>
> > which python2.7
> /opt/local/bin/python2.7
> > python2.7
> Python 2.7.2 (default, Aug 22 2011, 13:53:27)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import psycopg2
> >>>
>
> Thanks,
> David.
The only surprising output above is the result of "which python". I would have expected to see "/usr/bin/python", i.e. Apple's python. What's in your $PATH?
MacPorts python modules work with MacPorts' python, not Apple's python. This is simply our policy of not interfering with or modifying your system components.
Perhaps what you're looking for is MacPorts' "select" functionality. Try "sudo port select python python27". From then on, "python" will be MacPorts python2.7.
More information about the macports-users
mailing list