Python is an interpreted, object-oriented, dynamic Data type high-level programming language!
Python is automatically installed in the general system and can be used to view version information directly with the python command! If not installed can be installed directly with the following command!
[[email protected] ~]# Yum install-y python/If not installed on the PC, you can install it directly
can also be installed with the source package, we can write a shell script, directly installed:
#!/bin/bashcheck_ok () {if [ $? != 0 ];thenecho "Error,please check it now "exit 1fi}#### #源码包安装pythoncd /usr/local/srcif rpm -qa python;then rpm -e python wget https://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz check_okelse wget https://www.python.org /ftp/python/2.6.6/python-2.6.6.tgz check_okfi tar zxvf Python-2.6.6.tgz cd python-2.6.6 ./configure --prefix=/usr/local /python check_ok make make install check_ok ln -s /usr/local/python/bin/python2.6 /usr/bin/ python /If the computer has been installed Python, run this step, may be error, can be ignored directly, no impact! check_ok
Next, simply write a python script:
[Email protected] ~]# PYTHON-V/Note This is capitalized "V" view version number Python 2.6.6 write a python script [[email protected] ~]# vim hello.py /python script with. py suffix, pay attention to the habit #!/usr/bin/env python/Note the starting line, unlike the shell script print ' Hello World ' ~[[email protected] ~]# p Ython hello.py/Run Python script Hello World
This article is from the "Custom" blog, so be sure to keep this source http://zidingyi.blog.51cto.com/10735263/1726728
Beginners First chapter: Python Installation