功能:
- 支持自動補(bǔ)全忙菠, 交互式的數(shù)據(jù)可視化工具
- 自動縮進(jìn)
- 支持bash shell 命令何鸡, 是基本 BSD 開源的
- Jupyter 內(nèi)核
- 靈活、可嵌入的解釋器
- 內(nèi)置了許多很有用的功能和函數(shù)
python abc.py
python3 abc.py
exit() # 退出
ipython
exit # 退出
查看其支持的方法, 如:
C:\Windows\System32>ipython
Python 3.6.0b1 (default, Sep 12 2016, 18:11:36) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: list = []
In [2]: list.
append() count() insert() reverse()
clear() extend() pop() sort()
copy() index() remove()
In [3]: str = "s"
In [4]: str.
capitalize() format() islower() lower() rpartition() title()
casefold() format_map() isnumeric() lstrip() rsplit() translate()
center() index() isprintable() maketrans() rstrip() upper()
count() isalnum() isspace() partition() split() zfill()
encode() isalpha() istitle() replace() splitlines()
endswith() isdecimal() isupper() rfind() startswith()
expandtabs() isdigit() join() rindex() strip()
find() isidentifier() ljust() rjust() swapcase()
魔術(shù)命令
命令 說明
%quickref 顯示IPython的快速參考
%magic 顯示所有魔術(shù)命令的詳細(xì)文檔
%debug 從最新的異常跟蹤的底部進(jìn)入交互式調(diào)試器
%hist 打印命令的輸入(可選輸出)歷史
%pdb 在異常發(fā)生后自動進(jìn)入調(diào)試器
%paste 執(zhí)行剪貼板中的Python代碼
%cpaste 打開一個特殊提示符以便手工粘貼待執(zhí)行的Python代碼
%reset 刪除interactive命名空間中的全部變量/名稱
%page OBJECT 通過分頁器打印輸出OBJECT
%run script.py 在IPython中執(zhí)行一個Python腳本文件
%prun statement 通過cProfile執(zhí)行statement牛欢,并打印分析器的輸出結(jié)果
%time statement 報告statement的執(zhí)行時間
%timeit statement 多次執(zhí)行statement以計算系綜平均執(zhí)行時間骡男。對那些執(zhí)行時 間非常小的代碼很有用
%who、%who_ls傍睹、%whos 顯示interactive命名空間中定義的變量隔盛,信息級別/冗余度可變
%xdel variable 刪除variable,并嘗試清除其在IPython中的對象上的一切引用
win 下需要安裝, 步驟:
- 需要先下載pip pip.9.0.1.tag.gz工具:
https://pypi.python.org/pypi/pip#downloads
- 解壓后命令行安裝:
python setup.py install
- 為方便操作一般要配置環(huán)境變量:
C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Scripts
- 測試: 在命令行輸入:
ipython
ubuntu 安裝:
sudo apt-get install ipython
通過 ipython 啟動焰望。