CentOS 6安装python2.7和ipython

前端之家收集整理的这篇文章主要介绍了CentOS 6安装python2.7和ipython前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

CentOS 6安装python2.7和ipython


Centos 6自带的python版本是2.6
[root@C6~]#pythonPython2.6.6(r266:84292,Nov222013,12:16:22)
[GCC4.4.720120313(RedHat4.4.7-4)]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>
  • 如果想要安装2.7可以额外编译安装一个到指定的路径

  • 第二种方法是使用pyenv

所需要的软件

Python-2.7.13.tgz

ipython-1.2.1.tar.gz

1、安装python

[root@C6soft]#ls
ipython-1.2.1.tar.gzPython-2.7.13.tgz
[root@C6soft]#tarxfPython-2.7.13.tgz
[root@C6soft]#ls
ipython-1.2.1.tar.gzPython-2.7.13Python-2.7.13.tgz
[root@C6soft]#cdPython-2.7.13
#configure文件
[root@C6Python-2.7.13]#./configure--help
`configure'configurespython2.7toadapttomanykindsofsystems.

Usage:./configure[OPTION]...[VAR=VALUE]...
#在安装前要先安装所需环境
[root@C6Python-2.7.13]#yuminstallreadline-devel-y
[root@C6Python-2.7.13]#yumgroupinstall-y"DevelopmentTools"
#安装到指定路径下
[root@C6Python-2.7.13]#./configure--prefix=/usr/local/python27
[root@C6Python-2.7.13]#echo$?
0
[root@C6Python-2.7.13]#make&&makeinstall

python安装完成

[root@C6Python-2.7.13]#/usr/local/python27/bin/python2.7
Python2.7.13(default,Feb272017,18:23:38)
[GCC4.4.720120313(RedHat4.4.7-17)]onlinux2
Type"help","credits"or"license"formoreinformation.
>>>print"hellopython"hellopython

2、安装ipython

[root@C6ipython-1.2.1]#tarxfipython-1.2.1.tar.gz
[root@C6ipython-1.2.1]#cdipython-1.2.1
[root@C6ipython-1.2.1]#/usr/local/python27/bin/python2.7setup.pybuild
[root@C6ipython-1.2.1]#/usr/local/python27/bin/python2.7setup.pyinstall
[root@C6ipython-1.2.1]#echo$?
0
[root@C6ipython-1.2.1]#ls/usr/local/python27/bin/
2to3iploggerpydocpython2-config
idleiptestpythonpython-config
ipclusteripythonpython2smtpd.py
ipcontrollerirunnerpython2.7ipenginepycolorpython2.7-config

创建链接

[root@C6ipython-1.2.1]#ln-sv/usr/local/python27/bin/python2.7/usr/bin/python27
`/usr/bin/python27'->`/usr/local/python27/bin/python2.7'
[root@C6ipython-1.2.1]#ln-sv/usr/local/python27/bin/ipython/usr/bin/
`/usr/bin/ipython'->`/usr/local/python27/bin/ipython'

ipython安装完成

[root@C6~]#ipython
WARNING:IPythonHistoryrequiressqlite,yourhistorywillnotbesaved
Python2.7.13(default,18:23:38)
Type"copyright","credits"or"license"formoreinformation.

IPython1.2.1--AnenhancedInteractivePython.?
->IntroductionandoverviewofIPython'sfeatures.
%quickref->Quickreference.
help->Python'sownhelpsystem.
object?->Detailsabout'object',use'object??'forextradetails.
In[1]:print"helloworld"
helloworld
原文链接:https://www.f2er.com/centos/378590.html

猜你在找的CentOS相关文章