vscode在一起使用sql+python时无法将jupyter笔记本导出为html

ukqbszuj  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(295)

所有人!我正在vscode的jupyter笔记本上同时使用mysql和python。导入的环境如下:

import mysql.connector
from sqlalchemy import create_engine
engine = create_engine("mysql+mysqlconnector://***:***@***/abc")
engine.connect()
print("***DONE***")

随着

%load_ext sql
%sql mysql+mysqlconnector://***:***@***/abc
print("***SET***")

我之所以显示上述代码,是因为所有其他笔记本都很容易导出,但每当mysql引擎用于任何笔记本时,其中一个笔记本都无法导出为html甚至pdf。我需要帮助!
我还附加了vscode显示的输出(最后几行)。

File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\base\null.j2", line 31, in block "body_loop"
    {%- block any_cell scoped -%}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\base\null.j2", line 34, in block "any_cell"
    {%- block codecell scoped -%}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\lab\base.html.j2", line 12, in block "codecell"
    {{ super() }}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\base\null.j2", line 36, in block "codecell"
    {%- block input_group -%}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\lab\base.html.j2", line 19, in block "input_group"
    {{ super() }}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\base\null.j2", line 40, in block "input_group"
    {%- block input -%}{%- endblock input -%}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\lab\base.html.j2", line 27, in block "input"
    {{ cell.source | highlight_code(metadata=cell.metadata) }}
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\filters\highlight.py", line 54, in __call__
    return _pygments_highlight(source if len(source) > 0 else ' ',
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\filters\highlight.py", line 145, in _pygments_highlight
    lexer = get_lexer_by_name(language, stripall=True)
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\pygments\lexers\__init__.py", line 113, in get_lexer_by_name
    _load_lexers(module_name)
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\pygments\lexers\__init__.py", line 45, in _load_lexers
    mod = __import__(module_name, None, None, ['__all__'])
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\pygments\lexers\sql.py", line 50, in <module>
    from pygments.lexers._mysql_builtins import \
ModuleNotFoundError: No module named 'pygments.lexers._mysql_builtins'

  at a.executeCommand (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:24:143662)
  at runMicrotasks (<anonymous>)
  at processTicksAndRejections (internal/process/task_queues.js:97:5)
  at async a.export (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:49:260205)
  at async _.exportToFormat (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:49:259171)
  at async _.performExport (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:49:258214)
  at async _.export (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:49:257728)
  at async m.export (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:32:323595)
  at async S._executeContributedCommand (c:\Users\Yoyo\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:86:106762)]

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题