1.服务器上安装更新的python和代码提示(ipython)的安装
2016-01-16 20:20
761 查看
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源码包
执行当前文件夹下configure,之后安装,记得指定一下自己的安装位置
解档解压缩
创建链接
首先你需要源码包:
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!
相关文章推荐
- python 测试工具
- Python - Search Insert Position
- python 框架
- 七步精通Python机器学习 转
- python安装theano,其实是用anconda
- python的类变量与实例变量
- Python
- python tkinter实现简单计算器
- Windows下为64位的python3.4.3安装numpy
- 浅析python 中__name__ = '__main__' 的作用
- python中实现sftp
- [Leetcode]29. Divide Two Integers @python
- 在 windows 平台安装 opencv 和 python 联调
- Python简介和入门
- Python手动构造Cookie模拟登录后获取网站页面内容
- Python保存/提取数据的方法
- python programming
- [Leetcode]23. Merge k Sorted Lists @python
- python读取写入文件
- Python学习笔记 - 1