简体   繁体   中英

OSX Change Default Interpreter Python (importing matplotlib)

I try to visualize graph with matplotlib in python but I have few problem in my mac (Yosemite 10.10.2). I already installed matplotlib, and I know that I have 2 version of python installed in my computer, which are 2.7.8 and 2.7.6

Using default interpreter which is python 2.7.8, I got this error

dhcPlus-mbp:~ macbook$ python
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib

But if I try this one, it works on terminal. But I can't build straight from my Sublime with Ctrl+B

dhcPlus-mbp:~ macbook$ /usr/bin/python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> 

My question is, how could I change default python interpreter so I can use the 2.7.6 in my environment?

Any help is greatly appreciated. Thank you very much.

通过删除Mavericks上多余的Python库,解决了该问题

sudo rm -rf /Library/Frameworks/Python.framework/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM