QQ登录

只需一步,快速开始

登录 | 立即注册 | 找回密码

熊天琪游戏论坛 - 玩出名堂

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 16|回复: 0

[文本教程] CentOS6.5安装Python2.7.8以及安装iPython

[复制链接]
发表于 2018-10-10 02:13:52 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
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/ipythonWARNING: IPython History requires SQLite, your history will not be savedPython 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 pyIn [2]: import sysIn [3]: sys.<tab><tab>为了方便使用可用使用一个软链接[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 linux2Type "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 savedPython 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,因为系统自带的好多软件依赖自带的pythondir=/tmp/iPythonfile=Python-2.7.8.tar.xzfile2=ipython-2.3.1.tar.gznum=`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 0fi############################################################################################if [ -d $dir ]then    echo "iPython exist"else    sudo mkdir iPythonfi############################################################################################cd iPythonif [ -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 installelse    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 installfi###############################################################################################iPython 安装 依赖python2.7if [ -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 installelse    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 installfi#安装完成后为了添加软链接以便直接使用,注意这时候你有2个python一个是python27这是新版本的python和你系统自带的pythonsudo ln -sv /usr/local/python27/bin/python2.7 /usr/bin/python27sudo ln -sv /usr/local/python27/bin/ipython /usr/bin/
Python向PHP发起GET与POST请求 http://www.linuxidc.com/Linux/2014-10/107903.htm
《Python核心编程 第二版》.(Wesley J. Chun ).[高清PDF中文版] http://www.linuxidc.com/Linux/2013-06/85425.htm
《Python开发技术详解》.( 周伟,宗杰).[高清PDF扫描版+随书视频+代码] http://www.linuxidc.com/Linux/2013-11/92693.htm
Python脚本获取Linux系统信息 http://www.linuxidc.com/Linux/2013-08/88531.htm
在Ubuntu下用Python搭建桌面算法交易研究环境 http://www.linuxidc.com/Linux/2013-11/92534.htm
Python 语言的发展简史 http://www.linuxidc.com/Linux/2014-09/107206.htm
Python 的详细介绍:请点这里Python 的下载地址:请点这里
[table=98%][/table]
熊天琪的论坛真是太好啦, 我太喜欢熊天琪啦
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Loading...

QQ|小黑屋|Archiver|手机版|熊天琪 ( 鄂ICP备14006674号,鄂公网安备42020502000003号 

安全联盟

GMT+8, 2018-10-19 12:29 , Processed in 0.095104 second(s), 26 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表