Par*_*gue 6 python xelatex jupyter
每当我尝试将Jupyter笔记本导出为PDF时,我会在单独的窗口中收到以下错误:
500 : Internal Server Error
The error was:
nbconvert failed: xelatex not found on PATH, if you have not installed xelatex you may need to do so. Find further instructions at https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.
Run Code Online (Sandbox Code Playgroud)
我正在运行macOS Sierra 10.12.6.
我尝试过的事情:
运行
!echo $PATH
Run Code Online (Sandbox Code Playgroud)
产量:
/Users/ed/anaconda/bin:/Users/ed/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin
Run Code Online (Sandbox Code Playgroud)
我根据@einsweniger建议找到了包含xelatex的目录:/ usr/local/texlive/bin/x86_64-darwin.我将XeLatex复制并粘贴到上面的bin目录中,并得到一个新错误:
```nbconvert failed: PDF creating failed, captured latex output:
warning: kpathsea: configuration file texmf.cnf not found in these directories: /Users/e/anaconda/bin:/Users/ed/anaconda/bin/share/texmf-local/web2c:/Users/ed/anaconda/bin/share/texmf-dist/web2c:/Users/ed/anaconda/bin/share/texmf/web2c:/Users/ed/anaconda/bin/texmf-local/web2c:/Users/ed/anaconda/bin/texmf-dist/web2c:/Users/ed/anaconda/bin/texmf/web2c:/Users/ed/anaconda:/Users/edefilippis/anaconda/share/texmf-local/web2c:/Users/e/anaconda/share/texmf-dist/web2c:/Users/ed/anaconda/share/texmf/web2c:/Users/ed/anaconda/texmf-
This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2018) (preloaded format=xelatex)
kpathsea: Running mktexfmt xelatex.fmt
I can't find the format file `xelatex.fmt'!
```
Run Code Online (Sandbox Code Playgroud)
我也把xelatex.fmt放在目录中,但我仍然得到错误.
Nic*_*ico 22
我遇到了同样的问题。正如人们之前所说,问题在于在您的 PATH 环境变量中找不到 xlatex。
对我有用的解决方案是从笔记本运行以下内容:
!export PATH=/Library/TeX/texbin:$PATH
Run Code Online (Sandbox Code Playgroud)
或者在命令行中简单地:
export PATH=/Library/TeX/texbin:$PATH
Run Code Online (Sandbox Code Playgroud)
然后从命令行运行导出到 pdf(在您的虚拟环境中,如果有的话),如下所示:
jupyter nbconvert your_notebook.ipynb --to pdf
Run Code Online (Sandbox Code Playgroud)
这应该在它正在运行的同一目录中创建一个 pdf 的笔记本。
Dan*_*bir 18
在终端类型中
$ sudo apt-get install texlive-xetex texlive-fonts-recommended texlive-plain-generic
Run Code Online (Sandbox Code Playgroud)
正如尼科所说。运行以下命令
$ export PATH=/Library/TeX/texbin:$PATH
Run Code Online (Sandbox Code Playgroud)
将笔记本转换为 pdf 运行
$ jupyter nbconvert your_notebook.ipynb --to pdf
Run Code Online (Sandbox Code Playgroud)
我不习惯Mac的安装路径,从basictex常见问题解答说起,我收集了应包含在可执行文件中的可执行文件。在终端中/usr/local/texlive/bin/x86_64-darwin
运行which xelatex也可能有助于找到命令的位置,但是仅在目录已经在PATH变量中时才有效。
find / -name 'xelatex'如果另一种方法不在您的PATH中,则它将在运行,因此您可能会以这种方式找到它(可能需要一些时间,因为这会搜索整个硬盘驱动器)。
找到它并将路径添加到PATH变量后,还应该通过运行以下命令检查jupyter是否具有正确的PATH:
import os
print(os.environ['PATH'])
Run Code Online (Sandbox Code Playgroud)
在笔记本上。
| 归档时间: |
|
| 查看次数: |
6775 次 |
| 最近记录: |