找不到 pygments.lexers.BashLexer
can't find pygments.lexers.BashLexer
我正在尝试使用
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
在这种情况下,问题出在我的 .bashrc 中,它被设置为与 paraview 一起使用,如果我注释掉 pythonpath,那么 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
在这种情况下,问题出在我的 .bashrc 中,它被设置为与 paraview 一起使用,如果我注释掉 pythonpath,那么 pygments 可以正常工作