简体   繁体   中英

VS code opens Jupyter notebook in weird form

I'm using VS code with Jupyter notebook extension for python version 3.8.

When I open the any file with.ipynb by double clicking it, vs code shows the file in weird form like below.

{
 "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.

Does anyone know how to solve this issue?

在此处输入图像描述

  • I'm using Mac

From Jupyter in VS Code :

When a Notebook is Not Trusted, VS Code will not render Markdown cells or display the output of code cells within the Notebook. Instead, just the source of Markdown and code cells will be shown.

Open the.ipynb file from File--> Open File to check if its status is Not Trusted :

在此处输入图像描述

You can relaunch the trust notification prompt after reviewing the Notebook by clicking on the Not Trusted status, then choose Trust .

[UPDATE]

Change the "cell_type" from markdown to code .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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