What I've got: New copy of Yosemite, homebrew installation of python 2.7, Sublime Text 2 with the following packages: LaTex tools, Package Control, Rbox, and SublimeREPL. I downloaded package feedparser with Pip.
I'm new to python (and any coding beyond R) and I'm trying to set up a good workflow with Sublime Text 2. For some reason, when I try and load feedparser in the sublime REPL python window, I get "import error, no module named feedparser".
However, I can get the packaged to load from python in the terminal.
which python
in terminal I get back usr/local/bin/python
which is where homebrew puts python.
I have a limited understanding of this stuff, but I'm assuming its because REPL is using the old version of python that comes with OSX.
I tried changing the environment variable in the Python.sublime-build file according to this post (first answer):
Sublime Text 2: custom PATH and PYTHONPATH
Yet, it still does not work. Maybe I did it wrong? I'm not sure.
With the number of people using Sublime text and Python I know that this must get dealt with all of the time. I've lots of posts with people suggesting many different things and I'm fairly lost.
Thanks.
You can add a new menu item to
Tools -> SublimeREPL -> Python
. First, open yourPackages/User
directory by selectingSublime Text 2 -> Preferences -> Browse Packages...
and opening theUser
directory. Create a folder inUser
calledSublimeREPL
, inside that create aconfig
directory, and inside that create aPython
directory. Finally, make a new file in Sublime with JSON syntax and the following contents:Save this file as
Packages/User/SublimeREPL/config/Python/Main.sublime-menu
. Make sure you edit the"cwd"
parameter to set the folder you'd like the interpreter to open in.Now, if you open
Tools -> SublimeREPL -> Python
there will be an item calledPython (Homebrew)
that you can use to open an interpreter with/usr/local/bin/python
.