【问题标题】:Set IPython terminal as default in vscode?在 vscode 中将 IPython 终端设置为默认值?
【发布时间】:2020-11-26 20:29:46
【问题描述】:

我在 vscode 中安装了最流行的 Python 扩展。所以我可以shift+enter 将一些选定的代码执行到 python 终端

这使用/usr/bin/python3 作为默认值。我想改用 IPython3。但是,我在settings.json 中没有找到这样的设置。

如何在 vscode 中配置默认​​的 Python 终端?

【问题讨论】:

标签: python visual-studio-code


【解决方案1】:

1.“我可以通过shift+enter来执行一些选定的代码到python终端”的原因。就是说“shift+enter”是VSCode默认的快捷键,它执行的命令是“python.execSelectionInTerminal”:

{ "key": "shift+enter",           "command": "python.execSelectionInTerminal",
                                     "when": "editorTextFocus && !findInputFocussed && !jupyter.ownsSelection && !replaceInputFocussed && editorLangId == 'python'" },

2.在VSCode中设置默认终端为ipython,请使用“ipython.exe”执行settings.json中的文件:例如:

"terminal.integrated.shell.windows": "D:\\Users\\...\\AppData\\Local\\Programs\\Python\\Python38\\Scripts\\ipython.exe",

用途:

【讨论】:

    【解决方案2】:

    打开后缀为 .ipynb 的文件,剩下的工作由 vs 代码完成

    【讨论】:

    • 我不想使用 Jupyter!
    最近更新 更多