python的安装和版本选型

1.安装

官网的下载目录是 http://www.python.org/ftp/python/

按需下载

centos5的python是2.4.3,同时有python26的包可用,版本是2.6.5 epel的库里的

fedora的python是2.7,同时有python3的包可以用,版本是3.1.2


2.使用

建议用py3k的语法写,但是用python2.5/2.6/2.7运行(考虑到里面的库)

详细可以借鉴http://docs.python.org/py3k/library/__future__.html

from __future__ import print_function

然后就可以按照3k的语法来写了,但是可以在2.x上运行

feature optional in mandatory in effect
nested_scopes 2.1.0b1 2.2 PEP 227 : Statically Nested Scopes
generators 2.2.0a1 2.3 PEP 255 : Simple Generators
division 2.2.0a2 3.0 PEP 238 : Changing the Division Operator
absolute_import 2.5.0a1 2.7 PEP 328 : Imports: Multi-Line and Absolute/Relative
with_statement 2.5.0a1 2.6 PEP 343 : The “with” Statement
print_function 2.6.0a2 3.0 PEP 3105 : Make print a function
unicode_literals 2.6.0a2 3.0 PEP 3112 : Bytes literals in Python 3000

你可能感兴趣的:(html,python)