python安装<二>

centos系统默认装有Python模块,只需要运行Python命令即可开启Python模块

[root@localhost ~]# python

 Python 2.7.5 (default, Jun 17 2014, 18:11:42) 

[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> print"hello python"

hello python

>>> import platform
>>> print platform.uname()

('Linux', 'localhost.localdomain', '3.10.0-229.el7.x86_64', '#1 SMP Fri Mar 6 11:36:42 UTC 2015', 'x86_64', 'x86_64')

>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
[root@localhost ~]#

CentOS 7 系统的自带的Python是Python 2.7.5,所以我们只需要安装ipython即可。

ipython 是一个 python 的交互式 shell,比默认的python shell 好用得多,支持变量自动补全,自动缩进,支持 bash shell 命令,内置了许多很有用的功能和函数。

ipython下载地址:http://download.chinaunix.net/download/0005000/4865.shtml

ipython的源码下载页面为:https://pypi.python.org/pypi/ipython

或者是到git页面下载:https://github.com/ipython/ipython/downloads

rz   #上传ipython包
tar xf ipython-0.9.1.tar.gz 
cd ipython-0.9.1
python setup.py install   #安装ipython

ipython安装成功后,运行ipython命令,如下图

[root@localhost ipython-0.9.1]# ipython

**********************************************************************

Welcome to IPython. I will try to create a personal configuration directory

where you can customize many aspects of IPython's functionality in:


/root/.ipython

Initializing from configuration IPython/UserConfig


Successful installation!


Please read the sections 'Initial Configuration' and 'Quick Tips' in the

IPython manual (there are both HTML and PDF versions supplied with the

distribution) to make sure that your system environment is properly configured

to take advantage of IPython's features.


Important note: the configuration system has changed! The old system is

still in place, but its setting may be partly overridden by the settings in 

"~/.ipython/ipy_user_conf.py" config file. Please take a look at the file 

if some of the new settings bother you. 



Please press <RETURN> to start IPython.

**********************************************************************

Python 2.7.5 (default, Nov 20 2015, 02:00:19) 

Type "copyright", "credits" or "license" for more information.


IPython 0.9.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'. ?object also works, ?? prints more.

In [1]: print "hello python"
------> print("hello python")
hello python
In [2]: exit()
Do you really want to exit ([y]/n)? y
[root@localhost ipython-0.9.1]#

wKiom1Z-NzrB0mlAAABaaOJ4tT8251.png


安装ipython参考资料:http://www.dabu.info/linux-install-ipython.html

                     http://book.51cto.com/art/200910/156958.htm 

你可能感兴趣的:(linux,python,import,hello,ipython)