gpt4 book ai didi

jupyter-notebook - nbconvert 突然生成 .txt 而不是 .py

转载 作者:行者123 更新时间:2023-12-04 01:38:12 27 4
gpt4 key购买 nike

一段时间以来,我一直很高兴地通过运行

导出我的 Jupyter notebook 的 Python 可执行文件
 jupyter nbconvert --to script notebook.ipynb

创建 notebook.py。 OK,其实我一直在执行

!jupyter nbconvert --to script $s_script_path

来自笔记本内部,但应该没有什么不同。

今天,突然,相同的命令运行并生成文件 notebook.txt 而不是 .py。 (有细微差别,例如,In[1]: 之类的注释行不再存在。)为什么会这样,我如何返回到其他方式?

附言这似乎是在我在外部编辑器中更改并重新保存 .py 文件后发生的。不过,无法想象为什么这会有所作为。

最佳答案

如果您获取的是 txt 文件而不是 py,则键入以下命令:

jupyter nbconvert --to script filename.ipynb --to python

关于jupyter-notebook - nbconvert 突然生成 .txt 而不是 .py,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48568388/

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