简体   繁体   中英

Cannot open jupyter notebook in VSCode

I recently switched to Visual Studio Code and would like to use Jupyter Notebooks. I have installed the ms-python extension, and also the jupyter package, as described here .

However, after reloading, I did not have a command Python: Create Blank New Jupyter Notebook , and if I open existing notebooks, the HTML/CSS is shown instead of an actual notebook view. I haven't found anything related to this problem online yet.

If Python extension is available, (if not install that extension) in VSCode, while the jupyter style file (cells beginning with # %%) is active:

  1. Press Ctrl + Shift + P
  2. Type: Export Current Python File as Jupyter Notebook

An easy way to fix this should be to save the file with an .ipynb ending, vs-code should then automatically start the notebook extension. You can also make sure that you activated a Python environment, then Python: Create New Blank Jupyter Notebook should appear.

An alternative I would recommend is editing notebooks following this guide in the vs-code documentation

I understand that the Jupyter extension is not maintained. I just use the python extension now. I received this info from the vscode notification in the bottom right corner.

Here is a good explanation:https://code.visualstudio.com/docs/python/data-science-tutorial

I fixed by setting enviroment and workspace using terminal and this tutorial. Do not afraid if your purpose isn't data science, anyway knowledge are useful.

I had this same issue and found no answers online to solve it. What I've tried: 1- re-load Vs Code; 2- choose Python interpreter on Command Pallet (Ctrl + Shift + P); 3- Create New Blanck Notebook on Command Pallet (Ctrl + Shift + P); The editor would change to a notebook cell with Code and Markdown options if step 3 worked properly. 4- open your notebook (File > Open or Ctrl+Shift+E - if it is already part of your workspace).

Then I was able to run cells.

I believe it's not necessarily a Python Extension bug. But ended up giving up for now, because new little issues were showing up. I prefer using the python editor with #%% to create cells and run in Interactive Python.

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