Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set ipython/jupyter as the default python terminal for vscode?

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.

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.

Looked up

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

Use IPython REPL in VS Code

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

like image 873
Francio Rodrigues Avatar asked Oct 02 '18 19:10

Francio Rodrigues


People also ask

How do I change the default Python terminal in VS Code?

To do so, open the Command Palette (Ctrl+Shift+P) and enter Preferences: Open User Settings. Then set python.condaPath , which is in the Python extension section of User Settings, with the appropriate path.

How do I enable IPython in VS Code?

Type Ipython inside the terminal window. Then select the line or lines you want to run from the editor window and then click on the Terminal menu at the top of VScode window. One option in the Terminal menu is to "Run Selected Text". This will be run in the Ipython terminal window.


1 Answers

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

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

Edit: 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)

like image 165
Ant Avatar answered Oct 13 '22 04:10

Ant