jupyter notebook怎么将生成的图直接转化成HTML
时间: 2023-10-09 14:05:35 浏览: 75
将生成的图直接转化成HTML可以使用nbconvert。以下是转化步骤:
1. 在jupyter notebook中生成图,保存为ipynb文件。
2. 在终端中运行以下命令:
```bash
jupyter nbconvert --to html notebook.ipynb
```
这将把notebook.ipynb文件转化成HTML文件。
3. 如果只想转化notebook中的某个cell,可以在第二步中加入选项--to html --template basic --stdout input.ipynb --output output.html --execute --NbConvertApp.allow_errors=True --ExecutePreprocessor.timeout=-1 --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_input_tags='["hide-input"]',其中input.ipynb为输入文件,output.html为输出文件。
```bash
jupyter nbconvert --to html --template basic --stdout input.ipynb --output output.html --execute --NbConvertApp.allow_errors=True --ExecutePreprocessor.timeout=-1 --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_input_tags='["hide-input"]'
```
这将转化notebook中的某个cell,并将输出写入output.html文件中。