简体   繁体   English

如何使Sublime Text在Windows上读取PYTHONPATH环境变量

[英]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. 有几个在线资源描述如何使SublimeText读取在Windows开始菜单>控制面板>系统>高级设置>环境变量中指定的PYTHONPATH变量。

Yet, none of them clearly describe how to customize Sublime in Windows. 然而,他们都没有清楚地描述如何在Windows中自定义Sublime。 How do we do it? 我们该怎么做呢?

If using python 3.x you need to edit the Python3.sublime-build (Preferences > Browse packages > Python 3) 如果使用python 3.x,则需要编辑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"
}

env needs to be a JSON object, or dictionary if you will, like this: 如果你愿意,env需要是一个JSON对象或字典,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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