二.linux 下安装python
1》yum源安装
安装pip命令,用pip安装ipython(pip install python)
[iyunv@localhost ~]# cd soft/
[iyunv@localhost soft]# ls
epel-release-6-8.noarch.rpm
[iyunv@localhost soft]# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[iyunv@localhost soft]# cd /etc/yum.repos.d/
[iyunv@localhost yum.repos.d]# ls //yum目录下生成epel epel-testing.repo
a bak CentOS-Base.repo epel.repo epel-testing.repo
[iyunv@localhost yum.repos.d]# yum -y install python-pip
[iyunv@localhost yum.repos.d]# pip install ipython //安装ipython,会通过ipython的官网,下载当前最新的版本进行安装,注意,linux中python的版本是2.6,当前最新的iptyon的版本是6.0,网站上说明使用于python3,所以,安装后报错
[iyunv@localhost yum.repos.d]# pip install ipython==1.2.1 //指定ipython的版本进行安装,
。。。。。。
Installing collected packages: ipython
Running setup.py install for ipython
Successfully installed ipython-1.2.1
。。。。。。。。。。
[iyunv@localhost yum.repos.d]# pip list //查看
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
distribute (0.6.10)
iniparse (0.3.1)
ipython (1.2.1)
pip (7.1.0)
pycurl (7.19.0)
Pygments (2.2.0)
pygpgme (0.1)
pyxdg (0.18)
setuptools (0.6rc11)
six (1.10.0)
urlgrabber (3.9.1)
yum-metadata-parser (1.1.2)
[iyunv@localhost yum.repos.d]# ipython //输入ipython命令就会进入python下,具有补全功能
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- 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]:
2》源码安装ipython
[iyunv@www soft]# ls
51CTO下载-ipython-1.2.1.tar.gz
[iyunv@www soft]# tar xf 51CTO下载-ipython-1.2.1.tar.gz
[iyunv@www soft]# ls
51CTO下载-ipython-1.2.1.tar.gz redis-3.2.8.tar.gz
ipython-1.2.1 zabbix-2.0.12.tar.gz
mongodb-linux-x86_64-rhel62-3.2.7.tgz
[iyunv@www soft]# cd ipython-1.2.1/
[iyunv@www ipython-1.2.1]# ls
COPYING.txt examples PKG-INFO scripts setupegg.py setup.py
docs IPython README.rst setupbase.py setupext
[iyunv@www ipython-1.2.1]# python setup.py install //python执行setup脚本,就可以用ipython补全了
name = raw_input('please input you name: ')
print 'hell world %s' % name
>>> hell world
###############################################
please input you name: liuzhenchuan
hell world liuzhenchuan