Python,PIP:Windows安装Ipython
安装过程,没有太多可以说的,直接看代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
PS C:\WINDOWS\system32> pip install ipython Collecting ipython Using cached ipython-6.2.1-py3-none-any.whl Collecting simplegeneric>0.8 (from ipython) Using cached simplegeneric-0.8.1.zip Collecting colorama; sys_platform == "win32" (from ipython) Using cached colorama-0.3.9-py2.py3-none-any.whl Collecting jedi>=0.10 (from ipython) Using cached jedi-0.11.1-py2.py3-none-any.whl Collecting traitlets>=4.2 (from ipython) Using cached traitlets-4.3.2-py2.py3-none-any.whl Requirement already satisfied: setuptools>=18.5 in c:\program files\python36\lib\site-packages (from ipython) Collecting pygments (from ipython) Using cached Pygments-2.2.0-py2.py3-none-any.whl Collecting pickleshare (from ipython) Using cached pickleshare-0.7.4-py2.py3-none-any.whl Collecting decorator (from ipython) Using cached decorator-4.1.2-py2.py3-none-any.whl Collecting prompt-toolkit<2.0.0,>=1.0.4 (from ipython) Using cached prompt_toolkit-1.0.15-py3-none-any.whl Collecting parso==0.1.1 (from jedi>=0.10->ipython) Using cached parso-0.1.1-py2.py3-none-any.whl Requirement already satisfied: six in c:\program files\python36\lib\site-packages (from traitlets>=4.2->ipython) Collecting ipython-genutils (from traitlets>=4.2->ipython) Using cached ipython_genutils-0.2.0-py2.py3-none-any.whl Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.4->ipython) Using cached wcwidth-0.1.7-py2.py3-none-any.whl Installing collected packages: simplegeneric, colorama, parso, jedi, ipython-genutils, decorator, traitlets, pygments, p ickleshare, wcwidth, prompt-toolkit, ipython Running setup.py install for simplegeneric ... done Successfully installed colorama-0.3.9 decorator-4.1.2 ipython-6.2.1 ipython-genutils-0.2.0 jedi-0.11.1 parso-0.1.1 pickl eshare-0.7.4 prompt-toolkit-1.0.15 pygments-2.2.0 simplegeneric-0.8.1 traitlets-4.3.2 wcwidth-0.1.7 PS C:\WINDOWS\system32> |
需要用管理员模式启动PowerSHELL,否则你会遇到下面的错误:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
PS C:\Users\adamhuan> pip install ipython Collecting ipython Downloading ipython-6.2.1-py3-none-any.whl (745kB) 100% |████████████████████████████████| 747kB 16kB/s Collecting colorama; sys_platform == "win32" (from ipython) Downloading colorama-0.3.9-py2.py3-none-any.whl Collecting simplegeneric>0.8 (from ipython) Downloading simplegeneric-0.8.1.zip Collecting pickleshare (from ipython) Downloading pickleshare-0.7.4-py2.py3-none-any.whl Collecting decorator (from ipython) Downloading decorator-4.1.2-py2.py3-none-any.whl Collecting prompt-toolkit<2.0.0,>=1.0.4 (from ipython) Downloading prompt_toolkit-1.0.15-py3-none-any.whl (247kB) 100% |████████████████████████████████| 256kB 13kB/s Collecting pygments (from ipython) Downloading Pygments-2.2.0-py2.py3-none-any.whl (841kB) 100% |████████████████████████████████| 849kB 29kB/s Requirement already satisfied: setuptools>=18.5 in c:\program files\python36\lib\site-packages (from ipython) Collecting jedi>=0.10 (from ipython) Downloading jedi-0.11.1-py2.py3-none-any.whl (250kB) 100% |████████████████████████████████| 256kB 8.7kB/s Collecting traitlets>=4.2 (from ipython) Downloading traitlets-4.3.2-py2.py3-none-any.whl (74kB) 100% |████████████████████████████████| 81kB 18kB/s Requirement already satisfied: six>=1.9.0 in c:\program files\python36\lib\site-packages (from prompt-toolkit<2.0.0,>=1. 0.4->ipython) Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.4->ipython) Downloading wcwidth-0.1.7-py2.py3-none-any.whl Collecting parso==0.1.1 (from jedi>=0.10->ipython) Downloading parso-0.1.1-py2.py3-none-any.whl (91kB) 100% |████████████████████████████████| 92kB 17kB/s Collecting ipython-genutils (from traitlets>=4.2->ipython) Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl Installing collected packages: colorama, simplegeneric, pickleshare, decorator, wcwidth, prompt-toolkit, pygments, parso , jedi, ipython-genutils, traitlets, ipython Exception: Traceback (most recent call last): File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args) File "c:\program files\python36\lib\site-packages\pip\commands\install.py", line 342, in run prefix=options.prefix_path, File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 784, in install **kwargs File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files isolated=self.isolated, File "c:\program files\python36\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files clobber(source, lib_dir, True) File "c:\program files\python36\lib\site-packages\pip\wheel.py", line 316, in clobber ensure_dir(destdir) File "c:\program files\python36\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir os.makedirs(path) File "c:\program files\python36\lib\os.py", line 220, in makedirs mkdir(name, mode) PermissionError: [WinError 5] 拒绝访问。: 'c:\\program files\\python36\\Lib\\site-packages\\colorama' PS C:\Users\adamhuan> |
使用iPhython:
查看某个模块下的所有判断类函数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
PS C:\WINDOWS\system32> ipython.exe Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [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]: import os In [2]: ?os.path.is* os.path.isabs os.path.isdir os.path.isfile os.path.islink os.path.ismount In [3]: |
查询某个方法的帮助:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
In [3]: import json In [4]: import os In [5]: os.path.isfile? Signature: os.path.isfile(path) Docstring: Test whether a path is a regular file File: c:\program files\python36\lib\genericpath.py Type: function In [6]: In [11]: %pdef os.path.isfile os.path.isfile(path) In [12]: In [12]: %pdef os.path.islink os.path.islink(path) In [13]: |
Magic函数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
In [14]: %lsmagic Out[14]: Available line magics: %alias %alias_magic %autocall %autoindent %automagic %bookmark %cd %cls %colors %config %copy %cpaste %ddir %debug %dhist %dirs %doctest_mode %echo %ed %edit %env %gui %hist %history %killbgscripts %ldir %load %lo ad_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %macro %magic %matplotlib %mkdir %n otebook %page %paste %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %popd %pprint %precision %profile %p run %psearch %psource %pushd %pwd %pycat %pylab %quickref %recall %rehashx %reload_ext %ren %rep %rerun %r eset %reset_selective %rmdir %run %save %sc %set_env %store %sx %system %tb %time %timeit %unalias %unload _ext %who %who_ls %whos %xdel %xmode Available cell magics: %%! %%HTML %%SVG %%bash %%capture %%cmd %%debug %%file %%html %%javascript %%js %%latex %%markdown %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%svg %%sx %%system %%time %%timeit %%write file Automagic is ON, % prefix IS NOT needed for line magics. In [15]: |
magic函数的帮助:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
In [15]: %pinfo2? Docstring: Provide extra detailed information about an object. '%pinfo2 object' is just a synonym for object?? or ??object. File: c:\program files\python36\lib\site-packages\ipython\core\magics\namespace.py In [16]: In [16]: %save? Docstring: Save a set of lines or a macro to a given filename. Usage: %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ... Options: -r: use 'raw' input. By default, the 'processed' history is used, so that magics are loaded in their transformed version to valid Python. If this option is given, the raw input as typed as the command line is used instead. -f: force overwrite. If file exists, %save will prompt for overwrite unless -f is given. -a: append to the file instead of overwriting it. This function uses the same syntax as %history for input ranges, then saves the lines to the filename you specify. It adds a '.py' extension to the file if you don't do so yourself, and it asks for confirmation before overwriting existing files. If `-r` option is used, the default extension is `.ipy`. File: c:\program files\python36\lib\site-packages\ipython\core\magics\code.py In [17]: |
Magic函数的分类:
操作代码:
%run
%edit
%save
%macro
%recall
控制Ipython:
%colors
%xmode
%autoindent
%automagic
其他类:
%reset
%timeit
%%writefile
%load
%paste
——————————
Done。