Python Interactive programming

Source: Internet
Author: User
Tags jupyter jupyter notebook install matplotlib

Python Ipython, notebook, matplotlib installation use

Interactive programming does not require the creation of a script file, it is written in the interactive mode of the Python interpreter.

    • On Linux you only need to enter the Python command at the command line to start interactive programming

    • The default interactive programming client is already installed on window when you install Python

Note:> Chinese #!/usr/bin/python#-*-coding:utf-8-*-

Follow the steps to install the configuration

Python 3.5.2, Ipython 5.1.0, Jupyter notebook, matplotlib

1, installation python3.5

Please refer to the official documentation for specific installation. When installing the program, be careful to check the configuration environment variables. https://www.python.org/downloads/windows/

2. Upgrade Pip

python-m pip Install--upgrade pip

3. Install Ipython with PIP

Pip.exe Install Ipython

Interactive mode effects are as follows

d:\tools>ipythonpython 3.5.2  (V3.5.2:4DEF2A2901A5, JUN 25 2016, 22:01:18)  [MSC v.1900 32 bit  (Intel)]type  "copyright",  "credits"  or  " License " for more information. Ipython 5.1.0 -- an enhanced interactive python.?          -> introduction and overview of  ipython ' s features.%quickref -> quick reference.help       -> python ' S own help system.object?   -> details  about  ' object ', use  ' object?? '  for extra details. In [1]: print (' hello world! ') hello world! in [2]: a = [' Windows ', ' ten ', ' Python ', ' 3.5.2 ', ' Ipython ', ' Jupyter notebook ']in [3] :  aout[3]: [' Windows ',  ',  ' Python ',  ' 3.5.2 ',  ' Ipython ',   ' Jupyter notebook ']in [4]: for i in a:   ...:      print (i)    ...:windows10python3.5.2ipythonjupyter notebookin [5]:

4. Install notebook with PIP

Pip Install Notebook

Prompt for packages and versions that have been successfully installed

Installing collected Packages:jupyter-core, Markupsafe, JINJA2, Jsonschema, Nbformat, entrypoints, Mistune, Nbconvert, t  Ornado, PYZMQ, Jupyter-client, Ipykernel, notebook Running setup.py install for Markupsafe ... donesuccessfully installed MarkupSafe-0.23 entrypoints-0.2.2 ipykernel-4.5.0 jinja2-2.8 jsonschema-2.5.1 jupyter-client-4.4.0 jupyter-core-4.2.0 mistune-0.7.3 nbconvert-4.2.0 nbformat-4.1.0 notebook-4.2.3 pyzmq-15.4.0 tornado-4.4.2

Start notebook in the working directory

Jupyter notebookd:\tools>jupyter notebook[w 07:44:23.940 Notebookapp] Widgets is unavailable. Please install widgetsnbextension or ipywidgets 4.0[i 07:44:23.955 Notebookapp] The port 8888 are already in use, trying an Other port. [I 07:44:24.143 Notebookapp] Serving notebooks from local directory:d:\tools[i 07:44:24.143 Notebookapp] 0 active kernels[i 07:44:24.143 NotebookApp] The Jupyter Notebook is running at:http://localhost:8889/[i 07:44:24.143 Notebookapp] Use CONTROL-C to stop this server A nd shut-kernels (twice to skip confirmation).

Web

650) this.width=650, "title=" Jupyter_home.png "style=" Float:none; "alt=" Wkiom1f7sg6riirbaacipdwbkwq893.png-wh_50 " src= "Http://s5.51cto.com/wyfs02/M02/88/8C/wKiom1f7Sg6RiIrbAACIpDwBkwQ893.png-wh_500x0-wm_3-wmp_4-s_1936398854.png"/>

5. Installation Drawing Tool Matplotlib

Pip Install Matplotlibpip install matplotlib--upgrade

Result hints

Installing collected Packages:cycler, Pytz, pyparsing, NumPy, Python-dateutil, matplotlibsuccessfully installed cycler-0.10.0 matplotlib-1.5.3 numpy-1.11.2 pyparsing-2.1.10 python-dateutil-2.5.3 pytz-2016.7

6. Testing

b Image Test Code Source:

https://my.oschina.net/bery/blog/203595

import numpy as npimport matplotlib.pyplot as pltn = 5menmeans =   (20, 35, 30, 35, 27) menstd =    (2, 3, 4, 1,  2) Ind = np.arange (N)   # the x locations for the groupswidth  = 0.35       # the width of the barsfig ,  ax = plt.subplots () Rects1 = ax.bar (ind, menmeans, width, color= ' R ',  YERR=MENSTD) womenmeans =  (25, 32, 34, 20, 25) womenStd =     (3, 5, 2, 3, 3) Rects2 = ax.bar (Ind+width, womenmeans, width,  color= ' y ',  yerr=womenstd) # add someax.set_ylabel (' Scores ') ax.set_title (' Scores by  group and gender ') ax.set_xticks (ind+width) ax.set_xticklabels (  ' G1 ',  ' G2 ',  ' G3 ' ,  ' G4 ',  ' G5 ')  ) Ax.legend (  (rects1[0], rects2[0]),  (' Men ',  ' women ')  ) Def autolabel (rects ):     # attach some text labels    for rect  in rects:        height = rect.get_height ()          ax.text (rect.get_x () +rect.get_width ()/2., 1.05*height,  '%d '%int (height),                 Ha= ' center ',  va= ' bottom ') autolabel (rects1) AutoLabel (rects2) plt.show ()

650) this.width=650; "title=" Jupyter_py.png "style=" Float:none "alt=" wkiom1f7sguwflyyaad7gdkftck735.png-wh_50 "src = "Http://s4.51cto.com/wyfs02/M00/88/8C/wKiom1f7SguwFLYyAAD7gDkFtCk735.png-wh_500x0-wm_3-wmp_4-s_2246651733.png "/>

%matplotlib inlineimport NumPy as Npimport matplotlib.pyplot as Pltx = Np.arange (9) y = Np.sin (×) plt.plot (x, y) plt.show ()

650) this.width=650, "title=" Jupyter_py_1.png "style=" Float:none; "alt=" Wkiol1f7sgzwcqivaab_1ji8cbi398.png-wh_50 " src= "Http://s5.51cto.com/wyfs02/M00/88/89/wKioL1f7SgzwCqivAAB_1ji8cbI398.png-wh_500x0-wm_3-wmp_4-s_2143053922.png"/>



This article is from the "Heart" blog, make sure to keep this source http://bennychen.blog.51cto.com/6323894/1860258

Python Interactive programming

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.