V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
XIVN1987
V2EX  ›  Sublime Text

Sublime 中如何快速切换 Python 解释器

  •  
  •   XIVN1987 · 2019-11-12 19:01:12 +08:00 · 3111 次点击
    这是一个创建于 1617 天前的主题,其中的信息可能已经有所发展或是发生改变。

    vscode 可以在左下角下拉框中选择使用哪个 Python 解释器,,非常方便、快捷

    请问 Sublime 有没有类似的功能

    5 条回复    2019-11-14 10:39:05 +08:00
    jfcherng
        1
    jfcherng  
       2019-11-13 13:46:02 +08:00
    你是說 console 裡的 python 解釋器?還是 build 的?

    conosle 的話沒得選,ST 3 只有 python 3.3,ST 4 可以用 3.8。
    build 的話可以寫 variants,見 https://www.sublimetext.com/docs/3/build_systems.html#options。
    jfcherng
        2
    jfcherng  
       2019-11-13 13:46:28 +08:00
    最後的句號被識別為 URL 了...
    XIVN1987
        3
    XIVN1987  
    OP
       2019-11-13 14:12:01 +08:00
    @jfcherng

    执行的话我用 py.exe + shebang 完美解决了

    这里问的是智能补全插件 SublimeJEDI 使用的 Python 解释器快速切换,,
    jfcherng
        4
    jfcherng  
       2019-11-13 14:23:11 +08:00
    https://github.com/srusskih/SublimeJEDI#settings

    Project settings? 雖然功能和你的要求不盡相同
    XIVN1987
        5
    XIVN1987  
    OP
       2019-11-14 10:39:05 +08:00
    给 SublimeJEDI 添加了快速 Python 切换功能,已 Pull,希望能合并

    https://github.com/srusskih/SublimeJEDI/pull/305

    具体用法如下:

    ### Quick Select/Switch Python

    Specify python interpreters used now and avaliabe

    ```json
    // User/sublime_jedi.sublime-settings
    {
    "python_interpreter": "D:/Python36/python.exe",
    "python_interpreters":
    [
    "D:/Python27/python.exe",
    "D:/Python36/python.exe",
    "D:/Python27/venv/Scripts/python.exe",
    "D:/Python27/vexe/Scripts/python.exe",
    "D:/Python36/venv/Scripts/python.exe",
    "D:/Python36/vexe/Scripts/python.exe",
    "D:/Python36/vweb/Scripts/python.exe"
    ]
    }
    ```

    And then, you can quick select/switch python by input 'SublimeJedi: Select Python' in command palette

    When a python file is opened or activated, the python interpreter used by JEDI will show on statusbar
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1003 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:05 · PVG 06:05 · LAX 15:05 · JFK 18:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.