Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MatPlotLib with Sublime Text 2 on OSX

I want to use matplotlib from my Sublime Text 2 directly via the build command.

Does anybody know how I accomplish that? I'm really confused about the whole multiple python installations/environments. Google didn't help.

My python is installed via homebrew and in my terminal (which uses brew python), I have no problem importing matplotlib from there. But Sublime Text shows me an import Error (No module named matplotlib.pyplot). I have installed Matplotlib via EPD free. The main matplotlib .dmg installer refused to install it on my disk, because no system version 2.7 was found. I have given up to understand the whole thing. I just want it to work.

And, I have to say, for every bit of joy python brings with it, the whole thing with installations and versions and path, environments is a real hassle.

Beneath a help for this specific problem I would appreciate any helpful link to understand and this environment mess.

like image 659
ruffy Avatar asked Dec 31 '25 03:12

ruffy


1 Answers

I had the same problem and the following fix worked for me:

1 - Open Sublime Text 2 -> Preferences -> Browse Packages

2 - Go to the Python folder, select file Python.sublime-build

3 - Replace the existing cmd line for this one:

"cmd": ["/Library/Frameworks/Python.framework/Versions/Current/bin/python", "$file"],

Then click CMD+B and your script with matplotlib stuff will work.

like image 152
Jesus Fidalgo Avatar answered Jan 02 '26 15:01

Jesus Fidalgo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!