gpt4 book ai didi

jupyter - 执行 jupyter nbconvert 时出现 TypeError

转载 作者:行者123 更新时间:2023-12-04 12:50:57 26 4
gpt4 key购买 nike

我在运行 jupyter nbconvert 时遇到问题。

它总是显示以下错误跟踪(即使是带有一些原始单元格的笔记本)

Traceback (most recent call last):
File "/home/miguel/.virtualenvs/ipython/bin/jupyter-nbconvert", line 11, in <module>
sys.exit(main())
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/traitlets/config/application.py", line 596, in launch_instance
app.start()
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 293, in start
self.convert_notebooks()
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/nbconvertapp.py", line 447, in convert_notebooks
self.exporter = cls(config=self.config)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/exporters/templateexporter.py", line 151, in __init__
super(TemplateExporter, self).__init__(config=config, **kw)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 101, in __init__
self._init_preprocessors()
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 250, in _init_preprocessors
self.register_preprocessor(preprocessor, enabled=True)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/nbconvert/exporters/exporter.py", line 211, in register_preprocessor
preprocessor_cls = import_item(preprocessor)
File "/home/miguel/.virtualenvs/ipython/local/lib/python2.7/site-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
TypeError: Item in ``from list'' not a string

这可能与我最近安装的 nbextensions 有关,因为几天前 jupyter nbconvert 命令曾经完美运行。

今天,我在安装 nbextensions 时遇到了一些问题。我尝试使用 conda,但当我按照 here 中的说明进行操作时,它最终起作用了。 .

最佳答案

我今天遇到了同样的问题。这似乎是 nbconvert 中的一个错误,如文档中所述 here .解决方案是编辑“jupyter_nbconvert_config.json”文件。对我来说,这默认位于我的主目录中:/home/me/.jupyter/jupyter_nbconvert_config.json

在那里,我更改了预处理器字符串,在它们前面添加了一个“r”:

{
"Exporter": {
"template_path": [
".",
"/usr/lib/python2.7/site- packages/jupyter_contrib_nbextensions/templates"
],
"preprocessors": [
r"jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor",
r"jupyter_contrib_nbextensions.nbconvert_support.PyMarkdownPreprocessor"
]
},
"NbConvertApp": {
"postprocessor_class": "jupyter_contrib_nbextensions.nbconvert_support.EmbedPostProcessor"
},
"version": 1
}

关于jupyter - 执行 jupyter nbconvert 时出现 TypeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38723801/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com