git_revision issues with scipy/numpy/matplotlib

Hans Mulder hansmu at xs4all.nl
Sat Jul 7 12:18:45 CEST 2012


On 7/07/12 07:47:56, Stephen Webb wrote:
> I installed py27-numpy / scipy / matplotlib using macports, and it ran without failing.
> 
> When I run Python I get the following error:
> 
> $>> which python
> 
> /Library/Frameworks/Python.framework/Versions/2.7/bin/python

That's a python from python.org, not from MacPorts.

> $>> python
> 
> Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43) 
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import numpy
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/__init__.py", line 128, in <module>
>     from version import git_revision as __git_revision__
> ImportError: cannot import name git_revision
> 
> I get the same error for all three packages. Is this a MacPorts issue or a different issue?

You have (at least) three pythons on your Mac: one from Apple
in /usr/bin, one from python.org (the one you found) and one
from MacPorts in /opt/local/bin/python

You may want to add /opt/local/bin to the front of your PATH;
that will also pick up the MacPorts version of other software
you've installed from MacPorts.

Or you can explicitly type the full path of the python you want.

Or you can define aliases, for example:

alias apple_python=/usr/bin/python
alias macport_python=/opt/local/bin/python

lfpv=/Library/Frameworks/Python.framework/Versions
alias python_org_python=$lfpv/2.7/bin/python


Hope this helps,

-- HansM



More information about the Python-list mailing list