VSCode中设置用IPython运行Python代码

VSCode中设置用IPython运行Python代码

在IPython中运行所选的代码:

在设置中, 找到python.terminal.launchArgs这一项, 设置为如下内容.
"python.terminal.launchArgs": [
   "-m",
   "IPython",
   "--no-autoindent",
]

在IPython中自动重载模块:

https://stackoverflow.com/questions/35037815/how-to-automatically-reload-modules-in-ipython

Step 1: Make sure you have the latest ipython version installed
$ ipython --version
Step 2: find out where your config file is
$ ipython profile create
Step 3: Open the config file with an editor based on the location of your config file. I use atom. For example:
$ atom ~/.ipython/profile_default/ipython_config.py
Step 4: Look for the following lines in the config file:
c.InteractiveShellApp.extensions = []
change it to:
c.InteractiveShellApp.extensions = ['autoreload']
and then uncomment that line
find:
c.InteractiveShellApp.exec_lines = []
change it to:
c.InteractiveShellApp.exec_lines = ['%autoreload 2']
and then uncomment that line
Done.

 

posted @ 2022-07-04 09:14  酱_油  阅读(1029)  评论(0编辑  收藏  举报