CentOS6.5 install Python2.7.8 and iPython

Source: Internet
Author: User

CentOS6.5 install Python2.7.8 and iPython

CentOS6.5 install python2.7.8 and iPython. Ipython supports tab completion. Of course, the default python is also supported.

Install 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
Test whether iPython is available
[Root @ kcw ipython-2.3.0] #/usr/local/python27/bin/ipython
WARNING: IPython History requires SQLite, your history will not be saved
Python 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 py
 
In [2]: import sys
 
In [3]: sys. <tab>
 
You can use a soft link for ease of use.
 
[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'

In this way, you can use it directly in bash. Note that there are two versions of python and one iPython in your system. Just use it directly.

[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 linux2
Type "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 saved
Python 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]:


Finally, a script is directly written.

#! /Bin/bash
#
# Rpm-q python
# Upgrade python to python 2.7. Be sure not to uninstall python that comes with the system, because many of the software that comes with the system depends on python that comes with it.
Dir =/tmp/iPython
File1_python-2.7.8.tar. xz
File2=ipython-2.3.1.tar.gz
Num = 'rpm-q python | grep python-8080' # determine if python on your current system is 2.7. Install ipython separately.
If [$? -Eq 0]
Then
Echo "Your python version is 2.7 or later. Please install iPython Usage: yum install ipython separately or follow the instructions below to install ipython"
Exit 0
Fi
######################################## ######################################## ############
If [-d $ dir]
Then
Echo "iPython exist"
Else
Sudo mkdir iPython
Fi
######################################## ######################################## ############
Cd iPython
If [-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 install
Else
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 install
Fi
######################################## ######################################## ##############
# Install iPython on python2.7
If [-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 install
 
Else
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 install
Fi
# After installation, add a soft link for direct use. Note that you have two python versions, python27. This is the new version of python and the python version that comes with your system.
Sudo ln-sv/usr/local/python27/bin/python2.7/usr/bin/python27
Sudo ln-sv/usr/local/python27/bin/ipython/usr/bin/

Python initiates GET and POST requests to PHP

Python core programming version 2. (Wesley J. Chun). [Chinese version of hd pdf]

Python development technology details. (Zhou Wei, Zong Jie). [hd PDF scan version + book guide video + code]

Obtain Linux information using a Python script

Build a desktop algorithm transaction research environment using Python in Ubuntu

A Brief History of Python Development

Python details: click here
Python: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.