gpt4 book ai didi

visual-studio-code - 为什么 Jupyter notebook 在 VS Code 中显示为 JSON 文件?

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

enter image description here
当我使用 command + shift + P 然后使用“jupyter:创建一个新项目”时,它运行良好。
对于这个文件,我使用了那个函数。有一天,我关闭了 VS Code,当我再次打开它时,我发现“ipynb”看起来像“json”。
我怎样才能让它回到 jupyter 笔记本?

最佳答案

  • 检查您是否使用了正确的 Jupyter 扩展。
    old donjayamanne.jupyter extension现在已被合并到 ms-toolsai.jupyter extension 中或被取代.在扩展列表中搜索“jupyter”应该同时显示它们,其中一个标记为“(已弃用)”。
    enter image description here
    如果您仍然拥有已弃用的,请将其卸载,然后安装新的。如旧扩展的描述中所述:

    This extension is no longer being maintained and all of its functionality has been (or will be) placed into the Microsoft Jupyter extension.

    Please download the Microsoft Jupyter Extension instead.


  • 检查您是否有 使用笔记本编辑器 启用。
    来自 Setting up your environment :

    By default, the Visual Studio Code Python extension will open a Jupyter Notebook (.ipynb) in the Notebook Editor. If you want to disable this behavior you can turn it off in settings. (Python > Data Science: Use Notebook Editor


    文档仍然提到旧设置,但从 VS Code 1.54 和新的 Microsoft Jupyter extension 开始,现在应该是:
    "jupyter.useNotebookEditor":true
    enter image description here
  • 检查您是否使用 Jupyter 包激活了 Python 环境。
    来自 Setting up your environment :

    To work with Jupyter notebooks, you must activate an Anaconda environment in VS Code, or another Python environment in which you've installed the Jupyter package. To select an environment, use the Python: Select Interpreter command from the Command Palette (+SHIFT+P).


    打开终端并检查您是否有 jupyteripykernel :
    (venv) test$ jupyter --version
    jupyter core : 4.7.1
    jupyter-notebook : not installed
    qtconsole : not installed
    ipython : 7.21.0
    ipykernel : 5.5.0
    jupyter client : 6.1.11
    jupyter lab : not installed
    nbconvert : not installed
    ipywidgets : not installed
    nbformat : not installed
    traitlets : 5.0.5
    Jupyter 扩展需要您安装 ipykernel :
    (venv) test$ pip install ipykernel
  • 关于visual-studio-code - 为什么 Jupyter notebook 在 VS Code 中显示为 JSON 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66517511/

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