自闭症是什么| 事业编有什么好处| 佝偻病缺少什么元素| 手指甲白是什么原因| 叶公好龙的意思是什么| 怀孕梦到蛇预示着什么| 酸入肝是什么意思| 淋球菌培养是检查什么| 青梅竹马什么意思| 贷款是什么意思| 仙人板板 是什么意思| 杨的右边念什么| lt是什么| 什么大专好就业| 蟑螂喜欢什么样的环境| 细菌性感染吃什么药| 泉中水是什么生肖| 5月10日什么星座| 建档立卡是什么| 阿飞是什么意思| 什么是湿气| 颈部多发淋巴结是什么意思| 乱伦是什么| 到底为什么| 中国铁塔是干什么的| 为什么会血压低| 肝多发钙化灶什么意思| 鸟飞进家里是什么预兆| 铁铁什么意思| 生肖鼠和什么生肖相冲| 借记卡是什么卡| 有什么有什么| 第一顺位是什么意思| 心功能iv级是什么意思| lt是什么意思| 为什么家里会有蜈蚣| 孕妇吃什么蔬菜| 房性早搏是什么意思| 芒果是什么季节的| 兰蔻适合什么年龄的人用| 梦见好多黄鳝是什么意思| 路上遇到蛇是什么征兆| 木屐是什么意思| 稍高回声是什么意思| 2b铅笔和hb铅笔有什么区别| 女人骨质疏松吃什么最好| 暖气是什么意思| 不成功便成仁的仁是什么意思| 胆碱是什么| 什么什么之财| 脑梗吃什么水果| 出水芙蓉是什么意思| 丙肝是什么病严重吗| ebohr手表什么牌子多少钱| 西红柿不能跟什么一起吃| 双向是什么意思| 油面筋是什么做的| 为什么人| 1921年中国发生了什么| 高血压能吃什么水果| 中将是什么级别| 虾头部黄黄的是什么| 肝钙化灶是什么意思| 什么蓝| 瀹是什么意思| 胸口痛吃什么药| 热淋是什么病| 肚子疼呕吐是什么原因| dvt是什么意思| 羊宝是什么| 减肥什么东西不能吃| 妈妈是什么意思| 挚爱适合用在什么人| 天蝎座跟什么星座最配| 百分点是什么意思| 教师节属什么生肖| 代管是什么意思| 5月8日是什么星座| 月经淋漓不尽是什么原因| 似乎的近义词是什么| 乙肝病毒核心抗体阳性是什么意思| 黄占读什么| no.是什么意思| 梦到插秧是什么意思| 积液是什么原因造成的| 旦上面加一横是什么字| 什么是制动| 什么洗面奶好| 爱之深恨之切是什么意思| 火箭军是干什么的| 可吸收线是什么颜色| 双肺间质性改变是什么意思| 武松是什么生肖| 乏力是什么感觉| 女生下边长痘痘是什么病| 肾阴虚吃什么食物补| 健忘是什么意思| 甲状旁腺激素高吃什么药| 肺纤维化什么意思| 山楂不能和什么一起吃| 骑马挥杆是什么牌子| 宠物蛇吃什么食物| nlp是什么意思| 漂脱是什么意思| 炎症是什么原因引起的| 会阴是什么部位| 慢性宫颈炎吃什么药| 痛风什么原因引起| 阿玛尼算什么档次| 眉头下方有痣代表什么| 非典是什么病| 前列腺炎是什么原因引起| 甲状腺结节吃什么| 津液亏虚吃什么中成药| 甲状腺过氧化物酶抗体高说明什么问题| 孕妇梦见狗是什么意思| 老打饱嗝是什么原因| 什么是真心| 8月6号是什么星座| 棺材一般用什么木头| 人体出汗多是什么原因| 面基是什么意思| 大熊猫属于什么科| bobby什么意思| 码是什么单位| 脚心疼是什么原因| 维生素吃多了有什么副作用| 铖字五行属什么| 炙的意思是什么| 36d是什么意思| glu是什么氨基酸| 天生丽质难自弃是什么意思| 过期蜂蜜还有什么用途| 什么叫易经| 再生纤维素纤维是什么| 男人到了什么年龄就性功能下降| 0到3个月的婴儿惊吓吃什么药| 1893年属什么| 肛周脓肿吃什么药| 阿西是什么意思| 咳嗽喝什么| 失恋什么意思| 大夫古代指什么| 清热燥湿是什么意思| uu解脲脲原体阳性是什么意思| 内痔疮用什么药治最好效果最快| 亿字五行属什么| 胸部ct挂什么科| 交可以组什么词| 星期天左眼皮跳是什么预兆| 肌膜炎是什么原因造成的| 勇者胜的上半句是什么| 月指什么生肖| 谷丙转氨酶高挂什么科| 什么鬼大家都喜欢| 尤甚是什么意思| 翻墙软件是什么| 卦不走空是什么意思| 六味地黄丸主治什么| 中医五行属什么| 吃豆腐是什么意思| 贵气是什么意思| 肝郁血瘀吃什么中成药| 扬是什么生肖| 手术室为什么在三楼| 睡醒手麻是什么原因引起的| 下午四点多是什么时辰| 属狗与什么属相相合| 秋葵有什么营养价值| 老炮是什么意思| 午门是什么意思| 怕冷又怕热是什么原因| 1963年五行属什么| 盘是什么意思| 喝苦荞茶有什么好处| 东华帝君是什么神仙| un读什么| 龙井茶属于什么茶| kpa是什么单位| 马来西亚信仰什么教| 胃ct能检查出什么病| 为什么总是头疼| 路政属于什么单位| 奔三是什么意思| 什么是问题| 嗫嚅是什么意思| 蛇鼠一窝是什么意思| 泌乳素高是什么原因引起的| 三月三号是什么星座| 466是什么意思| 是什么字| 甲功不正常有什么表现| 大黄米是什么米| 怀孕不到一个月有什么症状| 猪脚和猪蹄有什么区别| 木隶念什么| 膝盖积液用什么药最好| 三焦是什么| 自控能力是什么意思| 黑洞是什么意思| 松塔有什么用| 扁桃体发炎了吃什么药| 什么人容易得梦游症| 男扮女装是什么意思| ada医学上是什么意思| 黄柏的功效与作用是什么| 经常发低烧是什么原因| 红色菜叶的菜是什么菜| 钙化是什么意思啊| 幸福是什么的经典语录| 吾子是什么意思| 给事中是什么官| 金国人是现在的什么人| 错落有致的意思是什么| 县团委书记是什么级别| 疱疹是什么样子的| 5月22是什么星座| 尿素偏高是什么原因| 茶话会是什么意思| 组织部长是什么级别| 为什么小脑会萎缩| 螃蟹不能和什么食物一起吃| 包皮手术挂什么科| 丰衣足食是什么意思| 多汗症看什么科| 前壁后壁有什么区别| 蹂躏是什么意思| 丙型肝炎吃什么药最好| 男人遗精是什么原因造成的| 银鱼是什么鱼| messi是什么意思| 自缢是什么意思| 嗓子疼有痰吃什么药| 12月12号什么星座| 兔子的天敌是什么动物| 李知恩为什么叫iu| 子宫内膜炎是什么原因造成的| 这是什么车| 减肥吃什么水果好| 00属什么生肖| 汽车空调不制冷是什么原因| 唇炎涂什么药膏| mrsa医学上是什么意思| 议论纷纷是什么意思| 仓鼠爱吃什么东西| 2028什么年| 肉麻是什么意思| 黄鼠狼是什么科| 怀孕吃辣对胎儿有什么影响| 省委副书记是什么级别| 94年属什么的| 乙酰氨基葡萄糖苷酶阳性什么意思| 中图分类号是什么| 恐惧感是什么意思| 50岁用什么牌子化妆品好| 褒义词和贬义词是什么意思| 看高血压挂什么科| 四个月宝宝可以吃什么辅食| 598分能上什么大学| 一会硬一会软什么情况| 小人是什么意思| 驰字五行属什么| 面面俱到是什么意思| 国家一级演员是什么级别| 百度

Try to extend agent mode in VS Code!

“策”为何物?海昏侯墓的银马箠提供新解(1)

百度 库尔德武装的用意,可能在于希望在使饱受损失的武装获得喘息之机的同时,维持住阿勒颇以北仅剩的地盘,与土耳其军队继续周旋。

Jupyter (formerly IPython Notebook) is an open-source project that lets you easily combine Markdown text and executable Python source code on one canvas called a notebook. Visual Studio Code supports working with Jupyter Notebooks natively, as well as through Python code files. This topic covers the support offered through Python code files and demonstrates how to:

  • Work with Jupyter-like code cells
  • Run code in the Python Interactive Window
  • View, inspect, and filter variables using the Variables Explorer and Data Viewer
  • Connect to a remote Jupyter server
  • Debug a Jupyter notebook
  • Export a Jupyter notebook

To work with Jupyter notebooks, you must activate an Anaconda environment in VS Code, or another Python environment in which you've installed the Jupyter package. To select an environment, use the Python: Select Interpreter command from the Command Palette (??P (Windows, Linux Ctrl+Shift+P)).

Once the appropriate environment is activated, you can create and run Jupyter-like code cells, connect to a remote Jupyter server for running code cells, and export Python files as Jupyter notebooks.

Jupyter code cells

You define Jupyter-like code cells within Python code using a # %% comment:

# %%
msg = "Hello World"
print(msg)

# %%
msg = "Hello again"
print(msg)

Note: Make sure to save the code shown above in a file with a .py extension.

When the Python extension detects a code cell, it adds Run Cell and Debug Cell CodeLens adornments. The first cell also includes Run Below and all subsequent cells include Run Above:

Jupyter adornments for code cells in the VS Code editor

Note: By default, Debug Cell just steps into user code. If you want to step into non-user code, you need to uncheck Debug Just My Code in the Jupyter extension settings (?, (Windows, Linux Ctrl+,)).

Run Cell applies to only the one code cell. Run Below, which appears on the first cell, runs all the code in the file. Run Above applies to all the code cells up to, but not including, the cell with the adornment. You would use Run Above, for example, to initialize the state of the runtime environment before running that specific cell.

Selecting a command starts Jupyter (if necessary, which might take a minute), then runs the appropriate cell(s) in the Python Interactive window:

Code cells running in a Python Interactive window

You can also run code cells using (Ctrl+Enter) or the Python: Run Selection/Line in Python Terminal command (Shift+Enter). After using this command, the Python extension automatically moves the cursor to the next cell. If you're in the last cell in the file, the extension automatically inserts another # %% delimiter for a new cell, mimicking the behavior of a Jupyter notebook.

You can also click in the margin to the left of line numbers to set breakpoints. Then you can use Debug Cell to start a debugging session for that code cell. The debugger stops execution at breakpoints and allows you to step through code one line at a time and inspect variables (see Debugging for details).

Additional commands and keyboard shortcuts

The following table lists additional commands and keyboard shortcuts supported when working with code cells.

Command Keyboard shortcut
Python: Go to Next Cell Ctrl+Alt+]
Python: Go to Previous Cell Ctrl+Alt+[
Python: Extend Selection by Cell Above Ctrl+Shift+Alt+[
Python: Extend Selection by Cell Below Ctrl+Shift+Alt+]
Python: Move Selected Cells Up Ctrl+; U
Python: Move Selected Cells Down Ctrl+; D
Python: Insert Cell Above Ctrl+; A
Python: Insert Cell Below Ctrl+; B
Python: Insert Cell Below Position Ctrl+; S
Python: Delete Selected Cells Ctrl+; X
Python: Change Cell to Code Ctrl+; C
Python: Change Cell to Markdown Ctrl+; M

Using the Python Interactive window

The Python Interactive window, mentioned in the previous section, can be used as a standalone console with arbitrary code (with or without code cells). To use the window as a console, open it with the Jupyter: Create Interactive Window command from the Command Palette. You can then type in code, using Enter to go to a new line and Shift+Enter to run the code.

To use the window with a file, use the Jupyter: Run Current File in Python Interactive Window command from the Command Palette.

IntelliSense

The Python Interactive window has full IntelliSense – code completions, member lists, quick info for methods, and parameter hints. You can be just as productive typing in the Python Interactive window as you are in the code editor.

IntelliSense in the Python Interactive window

Plot Viewer

The Plot Viewer gives you the ability to work more deeply with your plots. In the viewer you can pan, zoom, and navigate plots in the current session. You can also export plots to PDF, SVG, and PNG formats.

Within the Python Interactive window, double-click any plot to open it in the viewer, or select the expand button on the upper left corner of the plot.

Plot Viewer with the Python Interactive window

Note: The Python Interactive window supports rendering plots created with matplotlib and Altair.

Variables Explorer and Data Viewer

Within the Python Interactive window, it's possible to view, inspect, and filter the variables within your current Jupyter session. Select the Variables button in the interactive window toolbar to open the Variables explorer after running code and cells, you'll see a list of the current variables, which will automatically update as variables are used in code.

Variables Explorer

For additional information about your variables, you can also double-click on a row or use the Show variable in data viewer button to see a more detailed view of a variable in the Data Viewer. Once open, you can filter the values by searching over the rows.

Data Viewer

Connect to a remote Jupyter server

You can offload intensive computation in a Jupyter notebook to other computers by connecting to a remote Jupyter server. Once connected, code cells run on the remote server rather than the local computer.

To connect to a remote Jupyter server:

  1. Run the Jupyter: Specify local or remote Jupyter server for connections command from the Command Palette (??P (Windows, Linux Ctrl+Shift+P)).

  2. Select how you would like to connect to a Jupyter server. Prompt to supply a Jupyter server URI

  3. If working remotely, provide the server's URI (hostname) with the authentication token included with a ?token= URL parameter when prompted. (If you start the server in the VS Code terminal with an authentication token enabled, the URL with the token typically appears in the terminal output from where you can copy it.) Alternatively, you can specify a username and password after providing the URI.

    Prompt to supply a Jupyter server URI

  4. The Python Interactive window indicates where code is run by displaying the URI (which is blurred out in the image below):

    The Python Interactive window showing that code is running on a remote Jupyter server

Note: For added security, Microsoft recommends configuring your Jupyter server with security precautions such as SSL and token support. This helps ensure that requests sent to the Jupyter server are authenticated and connections to the remote server are encrypted. For guidance about securing a notebook server, see the Jupyter docs.

Convert Jupyter notebooks to Python code file

When you've activated an environment with Jupyter installed, you can open a Jupyter notebook file (.ipynb) in VS Code and then convert it to Python code. Once you've converted the file, you can run the code as you would with any other Python file and also use the VS Code debugger. Opening and debugging notebooks in VS Code is a convenient way to find and resolve code bugs, which is difficult to do directly in a Jupyter notebook.

When you open a notebook file, Visual Studio Code will open it in the Notebook Editor automatically. Use the convert icon on the toolbar to convert the Notebook (.ipynb) file to a Python file (.py).

Icon to convert a Jupyter notebook file

Select the convert icon followed by "Python Script", wait a few seconds, and then VS Code opens the converted notebook in an untitled file. The notebook's cells are delimited in the Python file with # %% comments; Markdown cells are converted wholly to comments preceded with # %% [markdown], and render as HTML in the interactive window alongside code and output such as graphs:

Jupyter notebook running in VS Code and the Python Interactive window

Note: The first time you run code cells in a Python file, the Python extension starts a Jupyter server. It may take some time for the server to start up and for the Python Interactive window to appear with the results of the code.

Debug a Jupyter notebook

The Visual Studio Code debugger lets you step through your code, set breakpoints, examine state, and analyze problems. Using the debugger is a helpful way to find and correct issues in notebook code.

  1. In VS Code, activate a Python environment in which Jupyter is installed, as described at the beginning of this article.

  2. Import the notebook's .ipynb file into VS Code as described in the previous section. (Download the file first if you're using a cloud-based Jupyter environment such as Azure Notebooks.)

  3. To start the debugger, use one of the following options:

    • For the whole notebook, open the Command Palette (??P (Windows, Linux Ctrl+Shift+P)) and run the Jupyter: Debug Current File in Python Interactive Window command.
    • For an individual cell, use the Debug Cell adornment that appears above the cell. The debugger specifically starts on the code in that cell. By default, Debug Cell just steps into user code. If you want to step into non-user code, you need to uncheck Debug Just My Code in the Jupyter extension settings (?, (Windows, Linux Ctrl+,)).
  4. To familiarize yourself with the general debugging features of VS Code, such as inspecting variables, setting breakpoints, and other activities, review VS Code debugging.

  5. As you find issues, stop the debugger, correct your code, save the file, and start the debugger again.

  6. When you're satisfied that all your code is correct. Save the file, then export the notebook as described in the following section. You can then upload the notebook to your normal Jupyter environment.

Export a Jupyter notebook

In addition to opening a Jupyter notebook, you can also use one of the following commands from the Command Palette (??P (Windows, Linux Ctrl+Shift+P)) to export content from a Python file in VS Code to a Jupyter notebook (with the .ipynb extension).

  • Jupyter: Export Current Python File as Jupyter Notebook: creates a Jupyter notebook from the contents of the current file, using the # %% and # %% [markdown] delimiters to specify their respective cell types.
  • Jupyter: Export Current Python File and Output as Jupyter Notebook: creates a Jupyter notebook from the contents of the current file and includes output from code cells.
  • Jupyter: Export Interactive Window as Jupyter Notebook: creates a Jupyter notebook from the contents of the Python Interactive window.

After exporting the contents, VS Code displays a prompt through which you can open the notebook in a browser.

倒数第二颗牙齿叫什么 什么书在书店里买不到 婴儿血小板低是什么原因 瘟疫是什么病 可怜巴巴是什么意思
图号是什么 馒头吃多了有什么坏处 煜什么意思 葛根泡水有什么功效 野猫吃什么
电脑关机快捷键是什么 为什么同房后会出血 脂溢性脱发吃什么药 豆包什么意思 情有独钟什么意思
乐子是什么意思 吨位是什么意思 经常不吃晚饭对身体有什么影响 lee是什么牌子 俄罗斯用什么货币
tpa是什么意思hcv8jop3ns3r.cn 为什么一分钟就出来了wuhaiwuya.com 鱼豆腐是用什么做的hcv9jop2ns4r.cn 脚背麻木是什么原因hcv8jop0ns7r.cn 跖疣是什么hcv8jop5ns6r.cn
手麻挂什么科hcv7jop4ns7r.cn 李白长什么样hcv8jop0ns9r.cn 雌激素低有什么症状hcv9jop1ns1r.cn 截胡什么意思hcv7jop5ns4r.cn dan是什么单位hcv9jop1ns3r.cn
肝功十二项包括什么hcv8jop3ns9r.cn 包皮与包茎有什么区别hcv8jop4ns4r.cn 砗磲是什么hcv8jop5ns4r.cn 周遭是什么意思hcv9jop2ns9r.cn 男才女貌是什么意思hcv8jop5ns9r.cn
瓷娃娃什么意思hcv8jop6ns0r.cn 敬谢不敏是什么意思hcv7jop9ns7r.cn 干眼症用什么药最好hcv8jop1ns3r.cn 什么都不怕hcv8jop3ns0r.cn 凌晨两点是什么时辰hcv8jop4ns1r.cn
百度