简体   繁体   English

VS 代码以奇怪的形式打开 Jupyter 笔记本

[英]VS code opens Jupyter notebook in weird form

I'm using VS code with Jupyter notebook extension for python version 3.8.我正在为 python 3.8 版使用带有 Jupyter 笔记本扩展的 VS 代码。

When I open the any file with.ipynb by double clicking it, vs code shows the file in weird form like below.当我通过双击打开带有 .ipynb 的任何文件时,vs 代码以奇怪的形式显示该文件,如下所示。

{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# import functions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {

However, I open same files with File>Open File... then it shows normal form of Jupyter notebook, which has separate cells.但是,我使用 File>Open File... 打开相同的文件,然后它显示 Jupyter notebook 的正常形式,它有单独的单元格。

Does anyone know how to solve this issue?有谁知道如何解决这个问题?

在此处输入图像描述

  • I'm using Mac我正在使用 Mac

From Jupyter in VS Code :来自VS Code 中的 Jupyter

When a Notebook is Not Trusted, VS Code will not render Markdown cells or display the output of code cells within the Notebook.当 Notebook 不受信任时,VS Code 将不会呈现 Markdown 单元格或显示 Notebook 内代码单元格的 output。 Instead, just the source of Markdown and code cells will be shown.相反,将仅显示 Markdown 和代码单元的来源。

Open the.ipynb file from File--> Open File to check if its status is Not Trusted :File--> Open File打开 .ipynb 文件以检查其状态是否为Not Trusted

在此处输入图像描述

You can relaunch the trust notification prompt after reviewing the Notebook by clicking on the Not Trusted status, then choose Trust .在查看笔记本后,您可以通过单击Not Trusted状态重新启动信任通知提示,然后选择Trust

[UPDATE] [更新]

Change the "cell_type" from markdown to code ."cell_type"markdown更改为code

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM