一、历史背景
1991年,荷兰计算机程序员Guido van Rossum为了方便编写脚本代码和实现面向对象编程,创建了一种程序语言——Python。随着Python在计算机领域的不断普及和广泛应用,Python的使用者不断增多,因此需要一个开放源代码的许可证来规范Python在商业和个人项目中的使用方式,于是Python开发团队在1999年发布了Python License。
Python License是一个自由软件许可证,它为Python语言提供了一种适合商业和非商业用途的宽松版权授权。
二、Python License简介
Python License的主要特点是授权非常灵活,允许修改源代码、在商业和非商业领域中使用、分发和销售Python软件包。
此外,Python License还规定了用户需提供开源代码和版权信息,如果采用了Python软件包,必须在发布说明中注明。
Python License的基本版权条款如下:
Python Software Foundation License Version 2 -------------------------------------------- 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using Python 2.7.16 software in source or binary form and its associated documentation. 2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 2.7.16 alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright © 2001-2013 Python Software Foundation; All Rights Reserved" are retained in Python 2.7.16 alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or incorporates Python 2.7.16 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 2.7.16. 4. PSF is making Python 2.7.16 available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.7.16 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 2.7.16 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.7.16, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. 7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party. 8. By copying, installing or otherwise using Python 2.7.16, Licensee agrees to be bound by the terms and conditions of this License Agreement.
三、Python License主要条款
1、授权
Python License授权给许可方一个非排他性、免费的、全球范围内的使用权,包括使用、复制、分发、发行、展示、表演和派生。这意味着无论您是个人还是团体,不论您是开发商用还是个人项目,你都可以使用Python,包括修改它、创建依赖它的软件。
2、版权信息
Python License规定,你必须保持版权的完整性,例如你不能删除版权声明、不得将其改变,不能在你的派生版本中使用与Python开发者发不同的版本号。
3、开源取证
Python License要求开发人员提供开源代码并注明Python版权信息。如果你使用了Python包,你必须注明,即使你只是从源码编译,而没有源码中引用了代码。这就是所谓的取证(notice),它告诉人们你已经使用了Python软件包,告诉他们从哪里可以下载到它以及它的使用条件。
4、豁免赔偿
Python License开发者免责任说明了有关Python 2.7.16的责任豁免,包括任何使用和传播的相关风险。
5、终止
如果你不遵守Python License的条款和条件,许可将自动终止,并由此导致的任何问题应由你自行承担。
四、Python代码示例
# Python 程序用于检测用户输入的数字是否为质数 # 用户输入数字 num = int(input("请输入一个数字: ")) # 质数大于 1 if num > 1: # 查看因子 for i in range(2,num): if (num % i) == 0: print(num,"不是质数") print(i,"乘于",num//i,"是",num) break else: print(num,"是质数") # 如果输入的数字小于或等于 1,不是质数 else: print(num,"不是质数")