ryandesign at macports.org
Sat Sep 24 15:30:14 PDT 2011
On Sep 24, 2011, at 16:29, Jin-Rui Xu wrote:
> On Sat, Sep 24, 2011 at 4:14 PM, Ryan Schmidt wrote:
>> Exactly how are you running your code? i.e. by typing "python" (in which case, what does "which python" say?), by typing python2.7, by typing /opt/local/bin/python2.7, etc.
> I just typed "python" in my terminal to invoke interactive python. And I think it was apple's python 2.7.1. Now I typed python2.7 or /opt/local/bin/python2.7 and got the "MacPorts python2.7" which is python2.7.2. With 2.7.2, MMTK modules can be imported. Thanks very much!
> I am sure that my following questions are quite naive. But please explain a little bit for me as well as people who are not familiar with CS like me~~
> Can you explain differences between apple's python and Macports' python,
In this case, the relevant difference for you is that when you used MacPorts to install a python module, it was installed for use with MacPorts python, not for use with Apple's python.
MacPorts versions of software are also usually newer than the versions included with OS X.
> why typing "python" simply did not give the newest version of python
"which python" shows you what python you're using. It's probably /usr/bin/python, a.k.a. Apple's.
> and should I set up manually to fix this and how?
If you want "python" to be MacPorts python 2.7, use "sudo port select python".
Or run MacPorts python 2.7 explicitly by typing /opt/local/bin/python27.
More information about the macports-users