Python安装

来源:互联网 发布:淘宝助理销售属性空白 编辑:程序博客网 时间:2024/05/20 23:05

1安装需要的包

yum groupinstall "Development tools"yum install zlib-devel  bzip2-devel openssl-devel  ncurses-devel  sqlite-devel
2下载安装Python 2.7.10

--下载cd /optwget --no-check-certificate https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xztar xf Python-2.7.10.tar.xzcd Python-2.7.10--编译安装./configuremake  make altinstall
3将Python命令指向Python 2.7.10

[root@fyl bin]# whereis pythonpython: /usr/bin/python /usr/bin/python2.6 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/local/bin/python2.7 /usr/local/bin/python2.7-config /usr/local/lib/python2.7 /usr/include/python2.6 /usr/share/man/man1/python.1.gz[root@fyl bin]# rm /usr/bin/python[root@fyl bin]# ln -s /usr/local/bin/python2.7 /usr/bin/python[root@fyl bin]# pythonPython 2.7.10 (default, Sep 12 2015, 13:12:13) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> >>> exit()
4简单语法
[root@fyl Python]# more hello.py #!/usr/bin/pythonprint "hello woord!"[root@fyl Python]# python hello.py hello woord!


0 0