gpt-4o-2024-05-13· OpenAI
WildChat-4.8M (AI2)
vscode 插件 执行命令 "jupytext --to py xxx " 转换完成不打开py文件怎么写
- User
vscode 插件 执行命令 "jupytext --to py xxx " 转换完成不打开py文件怎么写
- Assistant
你可以创建一个自定义的 VS Code 任务,并在任务完成后不自动打开转换生成的
.py文件。以下是一种实现方式:- 安装 Jupytext 首先,确保你已经安装了 Jupytext。你可以通过以下命令安装:
shpip install jupytext- 创建 VS Code 任务
在你的项目根目录下创建一个
.vscode/tasks.json文件(如果文件夹或文件不存在则需要新建),添加以下内容:
json{ "version": "2.0.0", "tasks": [ { "label": "Convert notebook to Python script", "type": "shell", "command": "jupytext --to py ${file}", "group": { "kind": "build", "isDefault": true }, "presentation": { "reveal": "never", "panel": "new", "echo": true }, "problemMatcher": [] } ] }