How do you know where macports installs python packages to?

6,357

Solution 1

MacPorts installs Python 2.7 packages at /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages. Check to make sure that this path is in sys.path in Python. SciPy would be installed in scipy under that directory. Also check port contents py27-scipy to ensure that the files are in the right place.

Solution 2

port contents py27-scipy

compare this with the ouput of:

import sys
from pprint import pprint
pprint(sys.path)
Share:
6,357

Related videos on Youtube

xmaslist
Author by

xmaslist

Updated on September 17, 2022

Comments

  • xmaslist
    xmaslist over 1 year

    I am running macports to install scipy and such on OS X leopard with python 2.7. The install runs successfully, but running python and trying to import the packages I've installed, they're not found.

    What I'm running is:

    sudo python_select python27 
    sudo port install py27-wxpython py27-numpy py27-matplotlib 
    sudo port install py27-scipy py27-ipython
    

    Opening up python in interactive mode (it is the correct version of python), I type 'import scipy' and get a module not found error. What gives? How can I find out where it is installing the packages to instead?

    • mmmmmm
      mmmmmm over 13 years
      How do you start python - what bersion does it print at the start and what is the value of sys.path?
  • xmaslist
    xmaslist over 13 years
    If that path is not in sys.path, how can I add it?
  • fideli
    fideli over 13 years
    If you're running MacPorts Python located at /opt/local/bin/python then it should already be added for you. Are you sure you are running the right Python? Is /opt/local/bin in your PATH?
  • Valeriy Van
    Valeriy Van over 9 years
    Thanks! Always wanted to know such command as port contents.