Use Ipython to write interactive notebook in Pycharm

Source: Internet
Author: User
Tags jupyter jupyter notebook
Use Ipython to write interactive notebook in Pycharm

1. Install Anaconda. It is recommended that you download and install Anaconda, which contains a rich library and the Ipython we need to use next. All the operations are one-step, specifically from the Pycharm call Anaconda can refer to Baidu. Anaconda Download Tips for more details http://blog.csdn.net/zhoutaoccu/article/details/70880304
2. New Project Document, select Jupyter Notebook, that is, Ipython notebook file, and the suffix to. ipynb.





3. Edit the code. where In[index] means that the input box (can be multiple lines or a single line), click to run (or shift+enter), if there is output, it will appear below its corresponding display, and will automatically create a in[], the only disadvantage is that you have to use the mouse to click to the editing area, I want to have a shortcut key to this point. Out[index] represents the output, and [index] represents the ordinal number. Each time for a specific input serial number of the operation will make the serial number of in[index++] increased, equivalent to record the sequence of code with the serial number, if you have nothing to do, and the previous code changed, after the operation of the serial number will change, so will lead to serial number of confusion, inconvenient to view, So generally the final will clear all the serial number, that is, click on the rotation of the reset symbol restart kernel, go again. and Out[index] is consistent with In[index.

Ipython is actually the equivalent of a debugging tool that can only be executed step by step in the order you write, inheriting and visualizing every step of your operation.


so the best development idea is: in each module of the cell to write code, one step debugging, repeated argumentation, the final debugging through, click the reset symbol restart kernel, in order to last through the program, to achieve the number of renumber at the same time check the sequence of the role of Code, Finally, summarize all the code in a. py file as the final result. At the same time when the program is fully tuned, finally put it into the Checkpoint folder as the final notebook file for sharing and display.

The first run prompts you to confirm the Ipython URL so that you can view your Ipython notebook in the browser. If prompted token, is generally notebook problems, first click Cancel, and then prompts to open Jupyter notebook, such as fix correction notebook, download and installation of such tips, directly connected to do it.



4. Indicates that a single line of input is added under the selected in[], (ctrl+x) indicates that the cut (and Ipython is not deleted, so this is common), (CTRL + C) The running In[index after the copy is incremented, (Ctrl + V) pasted on the next line of the selected code, Indicates that the input ordinal is reset. This is equivalent to a notebook file has two separate files, the previous variable definition, the library import, the reset after the code is not valid, so strongly advised not to use, but for the first time or can be considered, so it is not related to the previous variables. At the same time, the right key split cell is useful, you can split the cell, the corresponding merge is the same.


5. The remaining edits on the title of the text, as well as the markdown used mainly for explanatory notes, are not explained in detail.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.