In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to use JupyterNotebooks to complete entry-level development in VS code". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
VS Code now provides native support for Jupyter Notebooks through the Python plug-in. A simple example that outlines its main functions is as follows.
Although many programmers choose to use IDE (that is, the integrated development environment) and really understand it by sticking to it, other programmers, including the author, like to explore different IDE options. This is not only because I want to know about the cool or unique features provided by each popular IDE, but also because I want to work on multiple projects with colleagues who communicate with various IDE and speak their "language" during project meetings.
When it comes to Python development, I prefer Jupyter Notebook and Visual Studio (VS) code.
VS Code Python extension
Jupyter Notebook has evolved into a popular IDE option. In addition to IPython, with the availability of other kernels, Jupyter Notebook can also support Java,R,Julia and other popular programming languages besides Python. These notebooks are integrated canvases of Markdown text and executable source code that support collaborative, scalable, and replicable team projects.
VS code, another open source IDE, is becoming increasingly popular among developers using various programming languages such as JavaScript,C# and Python, and the list of supported languages continues to expand as developers develop more relevant VS Code plug-ins. However, VS code does not have native support for creating and editing Jupyter Notebook.
There's a change! in 2019, with the newly developed VS Code Python plug-in, VS Code provides native support for Jupyter Notebook, so you don't have to run Jupyter Notebook to work on notebook.
Environment setting
To install the Jupyter package on your computer, you can run the following command to install notebook using the Python package installer (that is, pip) or run conda install-c conda-forgenotebook using the conda package manager. Of course, the computer should also have Python 3 and VS Code installed. If it is not already installed, you can refer to here for Python installation and there for VS Code installation.
Open the VS code and go to the "extensions" section. You can use the ⇧⌘ X (that is, Shift + Cmd+ X) shortcut (if you are using a Mac system) or Ctrl + Shift + X (switch to the Extenders section if you are using a Windows system). Search the text box for "Python" and the user should be able to see a list of related extensions. Click the extension named "Python"-the extension developed by Microsoft. Install the extension and restart VS Code as needed.
After completing the last few preparation steps, the VS code is ready to use Jupyter Notebooks.
Create Jupyter Notebooks
To create a new Notebook, simply go to View- > Command Palette (⇧⌘ P in Mac). After the palette pops up, search for "Jupyter" and select "Python: create a blank new Jupyter Notebook", which will create a new Notebook. To write the tutorial, the author created a Notebook called JupyterExample.ipynb, as follows:
Create a new Jupyter Notebook
Common usage
1. Insert and delete cells
To insert a cell, click the more login toolbar or the one to the left of the cell. To delete a cell, click the symbol to the right of the delete cell (that is, the trash can symbol).
Insert and delete cells
two。 Toggle cell content type and status
To switch content types, click the code / markdown area in the cell. To switch status, click the text input box to put it into edit mode. Click the vertical bar on the left side of the cell to switch to command mode. By clicking another cell, the previously selected cell becomes unselected. The state of the cell is represented by a vertical bar on the left side of the cell.
3. Shortcuts to command statu
The following shortcuts are available when the cell is in the command state, as shown in the solid blue bar on the left.
Shortcuts to command statu
View the original vscode_jupyter_commands.csv moderator ❤ by GitHub
4. Run the code unit
To run the code unit, simply click the symbol in the triangle code / markdown area. To run all the code units in notebook, simply click the double arrows in the top toolbar.
Run the code unit
Although not shown in the figure above, the triangle toolbar with the up arrow runs the code unit above the current code unit, while the triangle with the down arrow is to run the code unit under the code unit that is currently contained.
5. Variable viewer
To see a list of declared variables, simply click the variables in the toolbar, which displays all defined variables in a table. If you declare a new one, it is automatically included in the table.
Variable viewer
6. Picture viewer
For the generated picture, you can click the icon on the picture output corner, as shown below:
Picture viewer
In the picture viewer, there is a toolbar at the top, which has some common functions, such as zooming in and out and saving pictures.
This is the end of the introduction to "how to use JupyterNotebooks to complete entry-level development in VS code". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.