使用NbConvert将Jupyter Notebook转换为pdf的成功实践

When try to convert the jupyter notebook to pdf or latex, I meet an error:

nbconvert failed: Inkscape executable not found

Inkscape is a free and open-source vector graphics editor used to create vector images, primarily in Scalable Vector Graphics (svg) format, while other formats can be imported and exported.

After installing Inkscape, another error happened:

nbconvert failed: [WinError 2] 系统找不到指定的文件。

According to FileNotFoundError: [WinError 2] 系统找不到指定的文件_Code for Coffee-CSDN 博客, I set shell=True in file Lib/subprocess.py , another error happened:

nbconvert failed: Unable to find inkscape executable --version

According to #issuecomment-663735974, I reinstall Inkscape in a path with no whitespace (C:\Program instead of the default C:\Program Files), and then the error become:

TypeError: Inkscape svg to pdf conversion failed

which is common in the Internet. According to #issuecomment-662875923, I modify the svg2pdf.py because I meet the similar problem:

Converting notebook test.ipynb to latex
'"C:\Program\Inkscape\bin\inkscape.exe,0"' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

Having finished the modification, I finally sucessfully convert .ipynb to .latex, which works for both English name file and Chinese name file.
使用NbConvert将Jupyter Notebook转换为pdf的成功实践_第1张图片

However, when I try to convert .ipynb to .pdf, the LaTeX Compiler only works for English name file.

使用NbConvert将Jupyter Notebook转换为pdf的成功实践_第2张图片

你可能感兴趣的:(python,python)