CentOS 6安装python2.7和ipython
CentOS 6安装python2.7和ipythonCentos 6自带的python版本是2.6
# pythonPython 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
如果想要安装2.7可以额外编译安装一个到指定的路径
第二种方法是使用pyenv
所需要的软件
Python-2.7.13.tgz
ipython-1.2.1.tar.gz
1、安装python
# ls
ipython-1.2.1.tar.gzPython-2.7.13.tgz
# tar xf Python-2.7.13.tgz
# ls
ipython-1.2.1.tar.gzPython-2.7.13Python-2.7.13.tgz
# cd Python-2.7.13
#configure文件
# ./configure --help
`configure' configures python 2.7 to adapt to many kinds of systems.
Usage: ./configure ... ...
#在安装前要先安装所需环境
# yum install readline-devel -y
# yum groupinstall -y "Development Tools"
#安装到指定路径下
# ./configure --prefix=/usr/local/python27
# echo $?
0
# make && make install
python安装完成
# /usr/local/python27/bin/python2.7
Python 2.7.13 (default, Feb 27 2017, 18:23:38)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "hello python"hello python
2、安装ipython
# tar xf ipython-1.2.1.tar.gz
# cd ipython-1.2.1
# /usr/local/python27/bin/python2.7 setup.py build
# /usr/local/python27/bin/python2.7 setup.py install
# echo $?
0
# ls /usr/local/python27/bin/
2to3 iplogger pydoc python2-config
idle iptest python python-config
ipcluster ipython python2 smtpd.py
ipcontroller irunner python2.7 ipengine pycolor python2.7-config
创建链接
# ln -sv /usr/local/python27/bin/python2.7 /usr/bin/python27
`/usr/bin/python27' -> `/usr/local/python27/bin/python2.7'
# ln -sv /usr/local/python27/bin/ipython /usr/bin/
`/usr/bin/ipython' -> `/usr/local/python27/bin/ipython'
ipython安装完成
# ipython
WARNING: IPython History requires SQLite, your history will not be saved
Python 2.7.13 (default, Feb 27 2017, 18:23:38)
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 : print "hello world"
hello world
页:
[1]