背景
我们希望将ipynb文件转换成pdf文件,需要如何处理?
python
10:24:52.677 [error] If you have not installed xelatex (TeX), you will need to do so before you can export to PDF. For further instructions, please see https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.
To avoid installing xelatex (TeX), you might want to try exporting to HTML and using your browser's "Print to PDF" feature.
解决方案
正常方法
安装MiKTex,找到对应的版本进行安装。
便捷的方法
将所有的内容使用conda来进行管理
https://nbconvert.readthedocs.io/en/latest/install.html
python
conda install nbconvert
但是可能会出现如下报错:
python
nbconvert.utils.pandoc.PandocMissing: Pandoc wasn't found.
Please check that pandoc is installed:
https://pandoc.org/installing.html
解决方法
You can install Pandoc using a Conda Forge tool, like Conda, [Micro]Mamba or Pixi. Conda forge also includes multiple LaTeX and other relevant packages for Pandoc (including pandoc-citeproc, pandoc-plot, rsvg-convert via librsvg etc.). Note: conda forge installs a statically-linked executable.
您可以使用 Conda Forge 工具安装 Pandoc,例如 Conda、[Micro]Mamba 或 Pixi。Conda forge 还包括多个 LaTeX 和其他与 Pandoc 相关的软件包(包括 pandoc-citeproc、pandoc-plot、通过 librsvg 的 rsvg-convert 等)。注意:conda forge 会安装静态链接的可执行文件。
python
conda install -c conda-forge pandoc