找不到pygments.lexers.BashLexer

时间:2016-02-24 02:28:32

标签: python python-2.7 ipython jupyter pygments

我正在尝试使用

jupyter nbconvert example.ipynb --to slides

从ipython笔记本生成jsreveal幻灯片,但我不断从lexers.py收到错误:

File "/usr/local/lib/python2.7/dist-packages/IPython/lib/lexers.py", line 37, in <module>
from pygments.lexers import BashLexer, PythonLexer, Python3Lexer
ImportError: cannot import name BashLexer

其他所需的词法分析器似乎导入正常,我尝试重新安装pygments但它没有任何区别。我在linux mint 17.3上使用Ipython版本4.1.1和python 2.7.6

注意LatexFormatter似乎表现出类似的错误:

return self.preprocess(nb,resources)
File "/usr/local/lib/python2.7/dist-packages/nbconvert/preprocessors/latex.py", line 43, in preprocess
from pygments.formatters import LatexFormatter
ImportError: cannot import name LatexFormatter

1 个答案:

答案 0 :(得分:0)

在这种情况下问题出现在我的.bashrc中,设置用于paraview,如果我注释掉pythonpath然后pygments工作正常