본문 바로가기
Programming/python

VScode에 jupyter notebook, ipython 사용하기

by 단창 2019. 5. 16.

https://code.visualstudio.com/docs/python/jupyter-support

 

Working with Jupyter Notebooks in Visual Studio Code

Working with Jupyter Notebooks in Visual Studio Code

code.visualstudio.com

파이썬 고르기

Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).

 

Connect to a remote Jupyter server

You can offload intensive computation in a Jupyter notebook to other computers by connecting to a remote Jupyter server. Once connected, code cells run on the remote server rather than the local computer.

 

 

  1. Run the Python: Specify Jupyter server URI command from the Command Palette (Ctrl+Shift+P).

  2. When prompted, provide the server's URI (hostname) with the authentication token included with a ?token= URL parameter. (If you start the server in the VS Code terminal with an authentication token enabled, the URL with the token typically appears in the terminal output from where you can copy it.)

 

Debug a Jupyter notebook

The Visual Studio Code debugger lets you step through your code, set breakpoints, examine state, and analyze problems. Using the debugger is a helpful way to find and correct issues in notebook code.

  1. In VS Code, activate a Python environment in which Jupyter is installed, as described at the beginning of this article.

  2. Import the notebook's .ipynb file into VS Code as described in the previous section. (Download the file first if you're using a cloud-based Jupyter environment such as Azure Notebooks.)

  3. Follow the instructions to configure and run the debugger as described on Tutorial - Configure and run the debugger, using your imported .ipynb file, of course, and setting a breakpoint in an appropriate location in your notebook code.

  4. To familiarize yourself with the general debugging features of VS Code, such as inspecting variables, setting breakpoints, and other activities, review VS Code debugging.

  5. As you find issues, stop the debugger, correct your code, save the file, and run the debugger again.

  6. When you're satisfied that all your code is correct. Save the file, then export the notebook as described in the following section. You can then upload the notebook to your normal Jupyter environment.

반응형