1.服务器上安装更新的python和代码提示(ipython)的安装

    linux mint17.x和linux kali2等linux发行版本python版本已经都大家都在使用的2.7.6以上,但是面对我们的服务器centos5~6和redhat5~6往往python还是python2.6,但是当前服务器上众多软件都依赖于自带的python,这就需要我们在不卸载原有python的状况下使用新的版本。目前我们有两种方法,一种使用pyenv进行环境切换,一种使用源码包编译重新安装后在/usr/bin下创建软连接。这里我们使用第二种。单独安装python不具备使用Tab键进行代码提示的功效,我们安装ipython的库来添加这样一种功能。

    首先你需要源码包:

    python2.7.6百度云:http://pan.baidu.com/s/1pKcc6ev 密码:epev

    ipython1.2.1百度云:链接:http://pan.baidu.com/s/1eRi04Rw 密码:8td0

    提示:我没有在官网上找到ipython1.2.1的包,所以请使用该包的时候进行验证,以免存在安全问题。

    找到你的python2.7.6源码包

[root@localhost ~]# tar -xf Python-2.7.6.tgz
    进入解档解压文件夹下

[root@localhost ~]# tar -xf Python-2.7.6.tgz
[root@localhost Python-2.7.6]# ls
build          config.sub    Doc         Lib             Makefile         Modules  PCbuild         python         RISCOS
config.guess   configure     Grammar     libpython2.7.a  Makefile.pre     Objects  pybuilddir.txt  Python         setup.py
config.log     configure.ac  Include     LICENSE         Makefile.pre.in  Parser   pyconfig.h      python-gdb.py  Tools
config.status  Demo          install-sh  Mac             Misc             PC       pyconfig.h.in   README
    在安装以前先解决一个问题,有可能你安装后退格键无法使用,需要解决一下依赖关系。(请先设置好yum源,我的博客中有详细写)

[root@localhost Python-2.7.6]# yum install readline

    执行当前文件夹下configure,之后安装,记得指定一下自己的安装位置

[root@localhost Python-2.7.6]# ./configure --prefix=/usr/local/python27/
[root@localhost Python-2.7.6]# make && make install
    创建链接文件
[root@localhost bin]# ln /usr/local/python27/bin/python2.7 /usr/bin/python27
    到这里新版本的python就能使用了,执行

[root@localhost ~]# python27
Python 2.7.6 (default, Jan 15 2016, 21:27:22) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
    安装ipython

    解档解压缩

[root@localhost ~]# tar xf ipython-1.2.1.tar.gz
    进入解压位置

[root@localhost ~]# cd ipython-1.2.1
    安装ipython模块

[root@localhost ipython-1.2.1]# /usr/local/python27/bin/python2.7 setup.py build
[root@localhost ipython-1.2.1]# /usr/local/python27/bin/python2.7 setup.py install

     创建链接 

[root@localhost bin]# ln /usr/local/python27/bin/ipython /usr/bin/ipython
    使用ipython

[root@localhost bin]# ipython 
Python 2.7.6 (default, Jan 15 2016, 21:27: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]: 
    ok!

   


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值