python2.7安装ipython_CentOS6.5安装Python2.7.8以及安装iPython

CentOS6.5安装Python2.7.8以及安装iPython,Ipython支持tab补全 当然默认的python也可以支持。

安装python2.7.8

[root@kcw ipython-2.3.0]# tar xf ipython-2.3.0.tar.gz

[root@kcw ipython-2.3.0]# cd ipython-2.3.0

[root@kcw ipython-2.3.0]# /usr/local/python27/bin/python2.7 setup.py build

[root@kcw ipython-2.3.0]# /usr/local/python27/bin/python2.7 setup.py install

测试iPython是否可用

[root@kcw ipython-2.3.0]# /usr/local/python27/bin/ipython

WARNING: IPython History requires SQLite, your history will not be saved

Python 2.7.8 (default, Oct 26 2014, 20:29:45)

Type "copyright", "credits" or "license" for more information.

IPython 2.3.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 py"

Hello py

In [2]: import sys

In [3]: sys.

为了方便使用可用使用一个软链接

[root@kcw ipython-2.3.0]# ln -sv /usr/local/python27/bin/python2.7 /usr/bin/python27

`/usr/bin/python27' -> `/usr/local/python27/bin/python2.7'

[root@kcw ipython-2.3.0]# ln -sv /usr/local/python27/bin/ipython /usr/bin/

`/usr/bin/ipython' -> `/usr/local/python27/bin/ipython'

这样在bash里面直接使用就可以了,注意你的系统里就有2个版本的python和一个iPython了,直接使用就行。

[root@kcw ipython-2.3.0]# python27

Python 2.7.8 (default, Oct 26 2014, 20:29:45)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>>

[root@kcw ipython-2.3.0]# ipython

WARNING: IPython History requires SQLite, your history will not be saved

Python 2.7.8 (default, Oct 26 2014, 20:29:45)

Type "copyright", "credits" or "license" for more information.

IPython 2.3.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]:

最后直接写了个脚本

#!/bin/bash

#

#rpm -q python

#升级python为2.7 注意不要卸载系统自带的python,因为系统自带的好多软件依赖自带的python

dir=/tmp/iPython

file=Python-2.7.8.tar.xz

file2=ipython-2.3.1.tar.gz

num=`rpm -q python|grep python-2.7` #判断你当前系统上的python 如果是2.7 请单独安装ipython即可

if [ $? -eq 0 ]

then

echo "你的python版本是2.7及以上,请单独安装iPython Usage:yum install ipython 或者看下面安装ipython的方法即可"

exit 0

fi

############################################################################################

if [ -d $dir ]

then

echo "iPython exist"

else

sudo mkdir iPython

fi

############################################################################################

cd iPython

if [ -f $file ]

then

echo "$file is exist"

tar xf Python-2.7.8.tar.xz

cd Python-2.7.8

./configure --prefix=/usr/local/python27

sudo make && make install

else

wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz

tar xf Python-2.7.8.tar.xz

cd Python-2.7.8

sudo ./configure --prefix=/usr/local/python27

sudo make && make install

fi

##############################################################################################

#iPython 安装  依赖python2.7

if [ -f $file2 ]

then

echo "$file1 is exist"

tar xf ipython-2.3.1.tar.gz

cd ipython-2.3.1

sudo /usr/local/python27/bin/python2.7 setup.py build

sudo /usr/local/python27/bin/python2.7 setup.py install

else

wget https://pypi.python.org/packages/source/i/ipython/ipython-2.3.1.tar.gz#md5=2b7085525dac11190bfb45bb8ec8dcbf

tar xf ipython-2.3.1.tar.gz

cd ipython-2.3.1

sudo /usr/local/python27/bin/python2.7 setup.py build

sudo /usr/local/python27/bin/python2.7 setup.py install

fi

#安装完成后为了添加软链接以便直接使用,注意这时候你有2个python一个是python27这是新版本的python和你系统自带的python

sudo ln -sv /usr/local/python27/bin/python2.7 /usr/bin/python27

sudo ln -sv /usr/local/python27/bin/ipython /usr/bin/

Python 的详细介绍:请点这里

Python 的下载地址:请点这里

0b1331709591d260c1c78e86d0c51c18.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值