概述
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/3dbe33c02af182a420cebc51352f8733.png)
北京时间 2019 年 10 月 9 日,微软发布了全新的 VS Code Python 插件,带来了众多更新!其中,最大的更新就要属万众期待的 Jupyter Notebook 原生支持了!
我们来看看这次 Jupyter Notebook 的原生支持带来了哪些好用的功能吧!
创建 Jupyter Notebook
当安装好 Python 插件最新版后,使用快捷键 Ctrl+Shift+P 调出 Command Palette,然后输入 "Python: Create New Blank Jupyter Notebook" ,就能创建一个新的 Jupyter Notebook。
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/a843085b1515fa66af21f1e5e1e99b66.png)
如果你已经有一个 Jupyter Notebook 文件了,你可以在 VS Code 中双击打开这个文件,或者在 Command Palette 里通过 "Python: Open in Notebook Editor" 打开。
管理 cells
VS Code 的 Jupyter Notebook Editor 使得开发者可以轻松地创建、编辑和运行 code cells。
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/27ce4032ca1072bba8b03e0391712213.png)
添加额外的 code cells
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/23ca578f9627969e43f1cdff9cbc8b2e.png)
运行单个 code cell
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/022ce30b52ad6c9cecb3b2e3abb3c78e.png)
运行多个 code cells
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/c38bd260d98d4a13ffb99bca320c8cbd.png)
移动 code cell
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/49efd391b0a60fb2cbb524721e4ae3da.png)
删除 code cell
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/18b03308e6d1687c163524d725cec513.png)
在代码与 markdown 之间切换
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/7f59fbf6cb615e8abd53427f3b707c88.png)
Intellisense 支持
在 VS Code 中编辑 Jupyter Notebook 的 Python 代码,就犹如平时在 VS Code 编写 Python 文件一样,有强大的 IntelliSense(智能提示)、变量/函数的 hover 提示等等功能。
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/4c3b49d98a4d5533bab220e81361a1f0.png)
图表查看器
通过图表查看器,轻松查看输出的图表,放大缩小极为简便,还能导出为 PDF、SVG 或者 PNG 格式的文件。
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/819f8241d012f11cbd2940cab8941e89.png)
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/26d1773284dd90575be9586d4ab7a4ca.png)
数据查看器和变量查看器
在 VS Code 中,可以通过变量查看器实时地查看变量的类型、数量与值。
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/38848185fccc34c79b88d37f37cba1b1.png)
此外,还可以通过数据查看器浏览更具体的数据。
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/b208d3c20484fbdbd22588f73a30448b.png)
调试 Jupyter Notebook
目前,如果要调试 Jupyter Notebook,需要先把 Jupyter Notebook 转为 Python 文件,再进行调试。开发团队正在努力工作,未来,将能直接在 Jupyter editor 里进行调试!
![640?wx_fmt=png](https://file2.kaopuke.com:8081/files_image/2023062209/026222ed335ac38858f6a900440d2563.png)
连接到远程的 Jupyter server
使用快捷键 Ctrl+Shift+P 调出 Command Palette,然后输入 "Python: Specify Jupyter server URI"。
在输入框中,输入远程 Jupyter server 的 URI。
![640?wx_fmt=png](https://file2.kaopuke.com:8081/files_image/2023062209/1c98506b328b822f46cda86fa7d7e26d.png)
其他更新
除了 Jupyter Notebook 的原生支持,此次新版还带了其他重要更新。
运行按钮
Python 插件学习了 的做法,添加了一个运行按钮,方便大家一键运行代码。为了防止同时出现两个运行按钮,如果用户已经安装了 Code Runner,那么 Python 插件的运行按钮将不会显示。
![640?wx_fmt=png](https://file2.kaopuke.com:8081/files_image/2023062209/33186160fabd5fcff4c322a66408337a.png)
Lint 改进
新版本带来来三个新的 Lint 规则:
no method argument
no self argument
no cls argument
大家是不是对这些新功能已经期待已久了?赶紧来下载最新的 Python 插件来体验一下吧!
(本文由Python大本营转载,转载请联系原作者)
◆
精彩推荐
◆
2019 中国大数据技术大会(BDTC)再度来袭! 豪华 主席 阵容及 百位技术专家 齐聚, 15 场 精选 专题技术和行业论坛, 超强干货+技术剖析+行业实践立体解读 ,深入解析热门技术在行业中的实践落地。
![640?wx_fmt=jpeg](https://file2.kaopuke.com:8081/files_image/2023062209/78a2fd2df843a6bafc973a7cf4139b8c.png)
推荐阅读
-
5大必知的图算法,附Python代码实现
如何用爬虫技术帮助孩子秒到心仪的幼儿园(基础篇)
-
![640?wx_fmt=png](https://file2.kaopuke.com:8081/files_image/2023062209/6cba9abe9f2c434df7bd9c0d0d6e1156.png)
最后
以上就是闪闪黑米为你收集整理的微软也爱Python!VS Code Python全新发布!Jupyter Notebook原生支持终于来了!的全部内容,希望文章能够帮你解决微软也爱Python!VS Code Python全新发布!Jupyter Notebook原生支持终于来了!所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复