alphanumeric
alphanumeric

Reputation: 19329

How to make Sublime Text read PYTHONPATH environment variable on Windows

There are several online resources describing how to make SublimeText read PYTHONPATH variable specified in Windows Start menu > Control Panel > System > Advanced Settings > Environment Variables.

Yet, none of them clearly describe how to customize Sublime in Windows. How do we do it?

Upvotes: 3

Views: 1701

Answers (2)

Tanvi B
Tanvi B

Reputation: 1567

If using python 3.x you need to edit the Python3.sublime-build (Preferences > Browse packages > Python 3)
to look like this:

{
"path": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"env":{"PYTHONPATH":"/usr/local/lib/python:/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages"},
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}

Upvotes: 1

Tanvi B
Tanvi B

Reputation: 1567

env needs to be a JSON object, or dictionary if you will, like this:

  "env":
    {"PYTHONPATH":"/usr/local/lib/python:/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages"},

Upvotes: 0

Related Questions