如何将ipython/jupyter设置为vscode的默认python终端? [英] How to set ipython/jupyter as the default python terminal for vscode?

查看:431
本文介绍了如何将ipython/jupyter设置为vscode的默认python终端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何选择ipython/jupyter作为DEFAULT python终端?我将Windows 10和Linux计算机与anaconda一起使用.

How can I choose ipython/jupyter as the DEFAULT python terminal? I use both a windows 10 and a linux machine with the anaconda distribution.

如果我在终端上键入"ipython",它将打开一个ipython会话.如果我运行调试器或Shift + Enter一行,它将自动在准系统" python外壳程序上运行.应该很简单...但是我一直在搜索和弄乱设置半小时,没有成功.

If I type "ipython" on the terminal, it opens an ipython session. If I run the debugger or shift+enter a line, it automatically runs on a "barebones" python shell. Should be simple...but I have been googling and messing with the settings for half an hour with no success.

查找

https://code.visualstudio.com/docs/python/tutorial-flask

在VS Code中使用IPython REPL

,但是找不到在我的linux或win10机器上进行设置的方法.有什么想法吗?

but could not find a way to set it up on my linux or win10 machines. Any ideas?

推荐答案

一种实现@TwoUnderscorez答案的更简洁的方法是仅使用-m IPython启动模块:

A slightly neater way to achieve @TwoUnderscorez's answer is to just launch the module with -m IPython:

"python.terminal.launchArgs": [
   "-m",
   "IPython"
]

编辑:对于遇到IndentationError: unexpected indent错误的人,请尝试以下操作:

For anyone struggling with IndentationError: unexpected indent errors, try the following:

"python.terminal.launchArgs": [
   "-m",
   "IPython",
   "--no-autoindent",
]

(不会在现有答案中添加评论,但代表人数不足)

(wouldn't have just added a comment to the existing answer, but not enough rep)

这篇关于如何将ipython/jupyter设置为vscode的默认python终端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆