Correct Add Site-packages Folder To Sublime Text 3 Sys.path
1. Summary I don't understand, how I can make, that global site-packages path will add to Sublime Text 3 sys.path in each Sublime Text 3 start. 2. Reason I want, that in Sublime T
Solution 1:
You can also do this using the following:
import site
# if outside of a sublime text plugin class
all_views = sublime.active_window().views()
# or if inside use the 'view' variable, skip to line 9 and change
# all_views[0].settings to view.settings
if len(all_views) > 0:
external_python_path = all_views[0].settings().get("external_python_path")
sp = site.getsitepackages(external_python_path)
sp = [x for x in sp if "site-packages" in x.lower()]
sys.path.append(sp)
then in your Preferences.sublime-settings
file, you add a key:value
like
{
"somekey": "somevalue",
...,
"external_python_path": "path_to_python folder excluding the python.exe"
}
Post a Comment for "Correct Add Site-packages Folder To Sublime Text 3 Sys.path"