Can you shed some light on the interaction between the Python interpreter distributed with OS X and the one that can be installed through MacPorts?
While installing
May I also suggest using Continuum Analytics "anaconda" distribution. One benefit in doing so would be that you won't then need to modify he standard OS X python environment.
Points to keep in mind about Python
foobar.py
starts with #!/usr/bin/env python
, then you will always get the OS X Python. That's the case even though MacPorts puts /opt/local/bin
ahead of /usr/bin
in your path. The reason is that MacPorts uses the name python2.7
. If you want to use env
and yet use MacPorts Python, you have to write #!/usr/bin/env python2.7
.foobar.py
starts explicitly with #!/usr/bin/python
or with #!/opt/local/bin/python2.7
, then the corresponding Python interpreter will be used.What to keep in mind about pip
pip
for /usr/bin/python
, you need to run sudo /usr/bin/easy_install pip
. You then call pip
(which will not be installed by easy_install
in /usr/bin/pip
, but rather in /usr/local/bin/pip
)pip
for /opt/local/bin/python2.7
, you need to run sudo port install py27-pip
. You would then call pip-2.7
. You will get the pip in /opt/local/bin
. Be careful, because if you type pip2.7
you will get /usr/local/bin/pip2.7
(the OS X pip).Installing networkx
and matplotlib
networkx
for the OS X Python you would run sudo /usr/local/bin/pip install networkx
. I don't know how to install matplotlib on OS X Lion. It may be that OS X has to stick to numpy 1.5.1
because it uses it internally.networkx
and matplotlib
for MacPorts-Python, call sudo pip-2.7 install networkx
and sudo pip-2.7 install matplotlib
. matplotlib
installs with a lot of warnings, but it passes.