晚上八点半是什么时辰| 蚕豆是什么豆| 羊鞭是什么部位| 燕窝有什么好处| 一什么花生| 什么病| 什么气味能驱赶猫| 艾滋病的症状是什么样| 刚字五行属什么| 4pcs是什么意思| 中人是什么意思| 野馄饨是什么意思| 舅舅是什么关系| 心悸心慌是什么原因| 怀孕两个月出血是什么原因| 什么是钓鱼网站| 吃什么可以拉肚子| 肾功能不全有什么症状| 画是什么结构| 月经来了不能吃什么东西| 吐槽是什么意思| 女生食指戴戒指什么意思| 骨折吃什么水果| 什么饮料好喝又健康| 什么是间质瘤| 儿童过敏性咳嗽吃什么药| 公积金取出来有什么影响| 内痔用什么药| o型血为什么叫熊猫血| 割包皮有什么好处| 葱长什么样| 被蜱虫咬了有什么症状| 爸爸过生日送什么礼物| 人为什么会起鸡皮疙瘩| 结婚12年是什么婚| 百折不挠指什么生肖| 热水器什么品牌好| 10月是什么季节| 鼻甲肥大吃什么药最好| 瘫痪是什么意思| 气罐和火罐有什么区别| 医保自费是什么意思| 高脂血症是什么病| 眼睛发黄是什么原因引起的| 布洛芬缓释胶囊是什么药| 小鱼的尾巴有什么作用| 虫草花是什么| 985211大学是什么意思| 难怪是什么意思| 小狗感冒症状是什么样的| 心里发慌什么原因| 怀孕第一个月有什么反应| 工事是什么意思| 附睾炎吃什么药最有效| 过梁是什么| 马卡龙为什么这么贵| bp是什么| 吊兰开花有什么兆头| 金银花泡水喝有什么好处| 误会是什么意思| 腿血栓什么症状| 农历10月14日是什么星座| 磁共振是做什么的| 拜阿司匹林和阿司匹林有什么区别| 吃什么水果好| 海龟汤什么意思| 为什么会一直拉肚子| 狐臭和腋臭有什么区别| 头发爱出油什么原因| 女人肝胆湿热吃什么药| 军士长是什么军衔| p什么意思| 精油是什么| 左眼跳什么| 舌头中间裂纹是什么病| 台卡是什么| 包茎是什么| 滑精是什么原因| 电波是什么意思| gfr医学上是什么意思| 舌头口腔溃疡是什么原因引起的| 小混混是什么意思| 肛裂用什么药治最好效果最快| 凉皮什么做的| ceq是什么意思| 86岁属什么生肖| 座山雕什么意思| 女人什么时候最想男人| 处女座属于什么星象| 什么叫肺纤维化| 颈椎病用什么枕头最好| 淡奶油是什么| 帕金森挂什么科| 胃窦病变意味着什么| 公司董事是什么职务| dlco是医学上什么意思| 淤青擦什么药| 赡养是什么意思| 胰腺有什么作用| 1971年属什么生肖| 做b超需要挂什么科| 主动权是什么意思| 余事勿取 什么意思| 胃镜取活检意味着什么| 纳征是什么意思| sport是什么意思| 畏寒是什么意思| 桑螵蛸是什么| 喝菊花有什么好处| 赵本山什么时候死的| 补钙有什么好处| 房子什么朝向好| 10月30号是什么星座| 脖子左侧疼是什么前兆| 高炮是什么| 伤口发炎化脓用什么药| 一直很困想睡觉是什么原因| 珍母口服液有什么作用| 羊的守护神是什么菩萨| 梦见死鸡是什么预兆| 孙红雷的老婆叫什么名字| 双鱼座是什么星象| 吃什么能快速补血| 胸部周围痒是什么原因| 耳膜炎是什么症状| 亚甲炎吃什么药效果好| 百年老枞属于什么茶| ci是什么意思| 肝火旺是什么意思| 补充镁有什么好处| 国酒是什么酒| 核桃什么时候吃最好| 日本全称是什么| 胃疼吃什么药管用| 梦见蝴蝶是什么意思| 穿什么衣服显白| 擦伤用什么药好得快| 小孩腿抽筋是什么原因引起的| 半盏流年是什么意思| 梦见屎是什么预兆| zara是什么意思| 为什么起荨麻疹| 干净的什么| 晚上八点是什么时辰| 花生属于什么类| 王字旁加己念什么| 15岁可以做什么兼职| 观字五行属什么| 皮炎不能吃什么食物| 昕字取名什么寓意| 01是什么意思| 漫游是什么| trace是什么意思| 带状疱疹不能吃什么食物| 灰指甲医院挂什么科| 什么时间人流| 胃肠感冒什么症状| 7.31什么星座| 人造海蜇丝是什么做的| 为什么睡觉老是流口水| 宋美龄为什么没有孩子| 肚子老是胀是什么原因| 拔罐拔出水泡是什么原因| 表面积是什么意思| 头顶痛吃什么药| 应接不暇的暇是什么意思| lagogo是什么牌子| 势利是什么意思| 笔什么龙什么| 穆斯林是什么| 什么时候拔牙最好| 辰寅卯是什么生肖| 宫寒是什么意思| 男人吃洋葱有什么好处| 什么是棱长| 永加日念什么| 为什么叫八路军| 喝咖啡有什么坏处| 中药是什么| 湖南简称什么| 川崎病有什么症状| 3D硬金是什么意思| pa是什么| 五朵玫瑰花代表什么意思| 长期肚子疼是什么原因| 补钙吃什么维生素| 腺苷是什么| 散粉和粉饼有什么区别| 抗核抗体谱检测查什么的| 嚣张是什么意思| 旦上面加一横是什么字| 胃不好吃什么菜| 四大发明是什么| 40年是什么婚姻| 鼠入牛角是什么动物| 不悔梦归处只恨太匆匆是什么意思| 正师级相当于地方什么级别| 红代表什么生肖| 怀孕为什么不能吃韭菜| 雨字五行属什么| 左旋延胡索乙素是什么| 1551是什么意思| eb病毒感染是什么病| 小孩呕吐是什么原因| 总爱放屁是什么原因| 头皮结痂抠掉又结痂是什么病| 氟比洛芬是什么药| 呼吸困难吃什么药| 惊奇地什么| 大腿抽筋是什么原因引起的| 燃眉之急是什么意思| 什么是激素脸| 排卵期是指什么时候| 浸润癌是什么意思| 协警是什么编制| 青蒜炒什么好吃| 早餐吃什么最健康| 为什么不敢挖雍正陵墓| nec是什么牌子| 狗狗拉虫子又细又长吃什么药| 邪犯少阳证是什么意思| fujixerox是什么牌子| 高血压吃什么药效果好| 媛交是什么意思| 半夏生是什么意思| 爱我永不变是什么歌| 甲亢可以吃什么| 铁蛋白低吃什么可以补| 阴囊瘙痒用什么药最好| 维生素c是补什么的| 卵巢早衰吃什么可以补回来| 下嘴唇溃疡是什么原因| obl是什么意思| 什么还珠| 甲醛中毒有什么症状| 什么原因引起甲亢| 432是什么意思| 同比和环比是什么意思| 益生菌是什么东西| 说话鼻音重是什么原因| 山楂和什么泡水喝降血压| 散粉是干什么用的| 狗怀孕有什么症状| 芋圆是用什么做的| 过敏吃什么药| 饭后胃疼是什么原因| 一什么教室| 什么是阻生牙| 吃醋对身体有什么好处| 后背容易出汗是什么原因| 肌酐高什么原因| 25分贝相当于什么声音| 眼缘是什么意思| 土豆粉是什么做的| 手上掉皮什么原因| 血小板计数偏高是什么意思| 感冒咳嗽一直不好是什么原因| 吃什么水果补血| 60min是什么意思| 福禄是什么意思| 蜂王浆是什么东西| 姨妈疼吃什么止疼药| 小病不治下一句是什么| 西洋参和人参有什么区别| 百度

Try to extend agent mode in VS Code!

“创业浦东一路狂奔,我们都在创业路上”

百度 偏好转换与协商民主无论何种形式的民主都以达成共识为目的,但达成共识的方式却不尽相同。

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.

右手指发麻是什么原因 榴莲为什么是水果之王 我是舅舅的什么人 体检前要注意什么 子宫内膜为什么会增厚
过敏性鼻炎引起眼睛痒用什么药 牙囊肿是什么病严重吗 牡丹是什么植物 李隆基是李世民的什么人 恩客是什么意思
眼屎多用什么眼药水 脖子变粗了是什么原因 女性头部出汗吃什么药 为什么不建议做融合手术 外交部部长是什么级别
宁静是什么民族 猫吃什么下奶最快最多 宝石蓝是什么颜色 蕊五行属什么 智齿是什么
吃什么抑制食欲hcv9jop2ns9r.cn 巨蟹座喜欢什么星座1949doufunao.com 半夜喉咙痒咳嗽是什么原因hcv8jop6ns2r.cn 白细胞满视野是什么意思hcv7jop5ns5r.cn 什么人容易得眩晕症hcv9jop6ns3r.cn
3月27日是什么星座hcv8jop1ns5r.cn 脸发红发痒是什么原因hcv9jop7ns9r.cn 晚的反义词是什么wuhaiwuya.com 门庭若什么hcv9jop5ns3r.cn 为什么会打雷闪电hcv7jop5ns1r.cn
清热解毒煲什么汤最好naasee.com 肥皂剧是什么hcv7jop6ns0r.cn 气山读什么hcv8jop6ns6r.cn 小孩子注意力不集中看什么科hcv8jop3ns3r.cn 笑话是什么意思hcv7jop7ns3r.cn
长期喝枸杞水有什么好处和坏处hcv8jop6ns1r.cn 三言两语是什么生肖hcv8jop2ns0r.cn 梦见木头是什么意思hcv9jop2ns4r.cn 诺丽果有什么功效hcv8jop1ns2r.cn 为什么不建议打卧蚕呢hcv9jop8ns2r.cn
百度