Locate MacPorts package?

sudo port select --set python python27

is the best answer to install port's python system-wide


To find the location of installed components, use the contents subcommand:

port contents py27-numpy

As for getting python to find the package, see @fardjad's response.


MacPorts should install Python packages in /opt/local/Library/Frameworks/Python.framework/2.7/site-packages by default. So make sure to set $PYTHONPATH environment variable in your .profile file:

export PYTHONPATH="/opt/local/Library/Frameworks/Python.framework/Versions/2.7/site-packages"

Your PATH is incorrect. It appears to be picking up another Python 2.7, likely one installed using a binary installer from python.org or elsewhere, and not the MacPorts installed one. Try removing the the /Library/Frameworks/Python.framework/Versions/2.7/bin from PATH or just invoke the MacPorts Python directly:

/opt/local/bin/python2.7