Sublime Text 3在不使用Virtualenv的情况下构建Python代码

时间:2015-09-28 16:54:43

标签: python virtualenv sublimetext3 anaconda

我尝试使用Sublime Text 3来执行Python脚本。下载ST3包AnacondaVirtualenv后,我将我的Anaconda virtualenv路径添加到ST3包Virtualenv并激活了ST3插件找到的virtualenv之一。 ST3中的构建系统已设置为Python + Virtualenv

问题:构建一个导入已经安装在virtualenv中的模块import pyodbc的python脚本(可能在ST3中激活)会导致错误

Traceback (most recent call last):
  File "/Users/x/testPython/test.py", line 3, in <module>
    import pyodbc
ImportError: No module named pyodbc
[Finished in 0.1s with exit code 1]
[shell_cmd: python -u "/Users/x/testPython/test.py"]
[dir: /Users/x/testPython]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

为什么即使ST3安装在当前激活的virtualenv中,ST3也找不到该模块?

my.sublime项目

{
    "build_systems":
    [
        {
            "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
            "name": "Anaconda Python Builder",
            "selector": "source.python",
            "shell_cmd": "/Users/x/anaconda/envs/test/bin/python -u \"$file\""
        }
    ],
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "/Users/x/testPython"
        }
    ],
    "settings":
    {
        "python_interpreter": "/Users/x/anaconda/envs/test/bin/python"
    },
    "virtualenv": "/Users/x/anaconda/envs/test"
}

0 个答案:

没有答案