Python:面向对象的解释型计算机程序设计语言
IPython:一个交互式计算系统。主要包含三个组件:增加的交互式 “Python shell”,解耦的双过程通信模型,交互式并行计算的架构。支持变量自动补全。
IPython是一个 python 的交互式 shell,相对于python shell,增加了变量自动补全,自动缩进,支持 bash shell 命令,内置了其它有用的功能和函数。
特点:
强大的交互式shell
Jupyter 内核
交互式的数据可视化工具
灵活、可嵌入的解释器
易于使用,高性能的并行计算工具
1、编译安装Python
[root@test ~]# tar zxf Python-2.7.tgz
[root@test ~]# ll
[root@test ~]# cd Python-2.7
[root@test Python-2.7]# ll
总用量 848
-rwxr-x--- 1 1000 1002 402781 5月 28 2010 configure
-rw-r----- 1 1000 1002 124898 5月 28 2010 configure.in
drwxr-x--- 23 1000 1002 4096 7月 3 2010 Demo
drwxr-x--- 17 1000 1002 4096 7月 3 2010 Doc
drwxr-x--- 2 1000 1002 4096 7月 3 2010 Grammar
drwxr-x--- 2 1000 1002 4096 7月 3 2010 Include
-rwxr-x--- 1 1000 1002 7122 6月 14 2003 install-sh
drwxr-x--- 47 1000 1002 12288 7月 3 2010 Lib
-rw-r----- 1 1000 1002 14231 7月 3 2010 LICENSE
drwxr-x--- 11 1000 1002 4096 7月 3 2010 Mac
-rw-r----- 1 1000 1002 40618 4月 12 2010 Makefile.pre.in
drwxr-x--- 5 1000 1002 4096 7月 3 2010Misc
drwxr-x--- 9 1000 1002 4096 7月 3 2010 Modules
drwxr-x--- 3 1000 1002 4096 7月 3 2010 Objects
drwxr-x--- 2 1000 1002 4096 7月 3 2010 Parser
drwxr-x--- 10 1000 1002 4096 7月 3 2010 PC
drwxr-x--- 2 1000 1002 4096 7月 3 2010 PCbuild
-rw-r----- 1 1000 1002 33981 5月 8 2010 pyconfig.h.in
drwxr-x--- 2 1000 1002 4096 7月 3 2010 Python
-rw-r----- 1 1000 1002 53728 7月 3 2010 README
drwxr-x--- 5 1000 1002 4096 7月 3 2010 RISCOS
-rw-r----- 1 1000 1002 88705 6月 27 2010 setup.py
drwxr-x--- 22 1000 1002 4096 7月 3 2010 Tools
查询编译参数帮助:
[root@test Python-2.7]# ./configure --help
安装依赖包
[root@test Python-2.7]# yum installreadline-devel
Installed:
readline-devel.x86_64 0:6.0-4.el6
Dependency Installed:
ncurses-devel.x86_64 0:5.7-4.20090207.el6
Dependency Updated:
ncurses-base.x86_64 0:5.7-4.20090207.el6
ncurses-libs.x86_64 0:5.7-4.20090207.el6
编译安装Python
[root@test Python-2.7]# ./configure--prefix=/usr/local/python27
[root@test Python-2.7]# make & makeinstall
测试Python是否安装成功
[root@test Python-2.7]# /usr/local/python27/bin/python2.7
Python 2.7 (r27:82500, May 20 2018,20:05:39)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] onlinux2
Type "help","copyright", "credits" or "license" for moreinformation.
>>> print "hello world!"
hello world!
>>> exit()
2、安装IPython
[root@test Python-2.7]# cd
[root@test ~]# tar zxf ipython-1.2.1.tar.gz
[root@test ~]# cd ipython-1.2.1
[root@test ipython-1.2.1]# ls
COPYING.txt docs examples IPython PKG-INFO README.rst scripts setupbase.py setupegg.py setupext setup.py
安装ipython
[root@test ipython-1.2.1]#/usr/local/python27/bin/python2.7 setup.py build
[root@test ipython-1.2.1]#/usr/local/python27/bin/python2.7 setup.py install
[root@test ipython-1.2.1]# ls/usr/local/python27/bin/
2to3 ipcontroller iptest pycolor python2.7 smtpd.py
idle ipengine ipython pydoc python2.7-config
ipcluster iplogger irunner python python-config
创建链接文件
[root@test ipython-1.2.1]# ln -sv/usr/local/python27/bin/python2.7 /usr/bin/python27
"/usr/bin/python27" ->"/usr/local/python27/bin/python2.7"
[root@test ipython-1.2.1]# ln -sv/usr/local/python27/bin/ipython /usr/bin/
"/usr/bin/ipython" ->"/usr/local/python27/bin/ipython"
测试ipython是否安装成功
[root@test ipython-1.2.1]# ipython
WARNING: IPython History requires SQLite,your history will not be saved
Python 2.7 (r27:82500, May 20 2018,20:05:39)
Type "copyright","credits" or "license" for more information.
IPython 1.2.1 -- An enhanced InteractivePython.
? -> 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 field"
hello field
In [2]: import platform
In [3]: print platform.
platform.DEV_NULL platform.python_compiler
platform.architecture platform.python_implementation
platform.dist platform.python_revision
platform.java_ver platform.python_version
platform.libc_ver platform.python_version_tuple
platform.linux_distribution platform.re
platform.mac_ver platform.release
platform.machine platform.string
platform.node platform.sys
platform.os platform.system
platform.platform platform.system_alias
platform.popen platform.uname
platform.processor platform.version
platform.python_branch platform.win32_ver
platform.python_build
In [3]: print platform.release
In [4]: print platform.release();
2.6.32-279.el6.x86_64
In [5]: print platform.version();
#1 SMP Fri Jun 22 12:19:21 UTC 2012
In [6]: print platform.uname();
('Linux', 'test.field.com','2.6.32-279.el6.x86_64', '#1 SMP Fri Jun 22 12:19:21 UTC 2012', 'x86_64','x86_64')