1

I'm calling on psycopg2 with

import psycopg2

I get the std error

ImportError: No module named psycopg2

I installed my copy with macports, so I'm curious why it wouldn't work because all of the dependencies should be downloaded as well. I don't have any experience with Postgresql, nor this module, so I don't know what could be going wrong. Fact is, another project I'm trying to get built calls upon it, so if I could avoid using this I would. :)

I'm sure that postgresql is installed, but that has little to do with the fact that my installation can't find psycopg2. Any suggestinos would be appreciated.

$ which python

reveals

/Library/Frameworks/Python.framework/Versions/Current/bin/python

and

$ python --version

reveals

Python 2.7.3 -- EPD_free 7.3-2 (32-bit)

I don't necessarily want the version of EPD_free, but I had to install it for (somewhat) unrelated reasons.

4

1 回答 1

4

MacPorts installs its own version of Python alongside Apple's version. You can manage the active version of Python (the one that gets run when you type in python at the command line or by /usr/bin/env) by using the port select command. See this question.

于 2013-01-19T00:59:04.403 回答