Head Frist Python 读书笔记 构建发布

构建发布 p41

Windows系统需要使用“c:\pythonX\python.exe”执行,

或者,通过配置环境变量来简化输入

1. 首先需要在系统中注册python环境变量:假设python的安装路径为c:\python2.6,则修改我的电脑->属性->高级->环境变量->系统变量中的PATH为:

(为了在命令行模式下运行Python命令,需要将python.exe所在的目录附加到PATH这个环境变量中。)

PATH=PATH;c:\python26

上述环境变量设置成功之后,就可以在命令行直接使用python命令。或执行"python *.py"运行python脚本了。

2. 此时,还是只能通过"python *.py"运行python脚本,若希望直接运行*.py,只需再修改另一个环境变量PATHEXT:

PATHEXT=PATHEXT;.PY;.PYM

命令说明:

python setup.py sdist

(assuming you haven’t specified any sdist options in the setup script or config file), sdist creates the archive of the default format for the current platform. The default format is a gzip’ed tar file (.tar.gz) on Unix, and ZIP file on Windows.

You can specify as many formats as you like using the --formats option, for example:

python setup.py sdist --formats=gztar,zip

to create a gzipped tarball and a zip file. The available formats are:

Format Description Notes
zip zip file (.zip) (1),(3)
gztar gzip’ed tar file (.tar.gz) (2)
bztar bzip2’ed tar file (.tar.bz2)  
ztar compressed tar file (.tar.Z) (4)
tar tar file (.tar)  

Notes:

  1. default on Windows
  2. default on Unix
  3. requires either external zip utility or zipfile module (part of the standard Python library since Python 1.6)
  4. requires the compress program. Notice that this format is now pending for deprecation and will be removed in the future versions of Python.

When using any tar format (gztarbztarztar or tar), under Unix you can specify the owner and group names that will be set for each member of the archive.

For example, if you want all files of the archive to be owned by root:

python setup.py sdist --owner=root --group=root

tips:“打开一个终端窗口”,可以通过命令行cd到代码所在目录,也可以在所在目录shift+鼠标右键,调出命令窗口

时间: 2024-08-09 01:29:42

Head Frist Python 读书笔记 构建发布的相关文章

Head Frist Python 读书笔记 列表推导(list comprehension)

列表推导(list comprehension)是个挺有意思的功能,应该是一个语法糖吧,列表推导这个名字大概是意译,不过list comprehension这个真不知道该怎么翻译. 列表推导是Python支持函数编程概念的一个例子. 列表推导的功能是减少代码书写量,可以省点事情,本来需要两行的,现在只需要一行. 比如说要对一个list中的所有数据都进行相同的处理,通常可以这么写: data=[1,2,3,4,5,6] result=[] for item in data: result.appe

Head Frist Python 读书笔记 第六章 定制数据对象

Bullet Points: 定义Class python中的class和JavaScript中的类似(后悔没有认真看JS),原则只有一个“方法是共享的,而属性不共享” class AthleteList: def __init__(self,a_name,a_dob=None,a_times=[]): self.name=a_name self.dob=a_dob self.times=a_times def top3(self): return sorted(set([float(sanit

Head Frist Python 读书笔记 第五章 处理数据

Bullet Option: sort(*, key=None, reverse=None) sort方法用于原地排序,可以接收两个keyword-only参数,并且此方法是的排序是稳定的. key:一个表达式,比较时会根据该表达式的计算结果进行排序 reverse:默认False,升序排列:True,降序排列 默认使用升序排列 >>> source=[5,2,8,4,3,6,7] >>> source.sort() >>> print(source)

Python读书笔记1

最近在学习<编写高质量代码-改善python程序的91个建议>,记录下读书笔记 使用版本:Python 3.4.0 系统:Windows7 1.字符串格式化: 1 def show(name,age,email): 2 #普通方法 3 print('your name is: %s \nyour age is: %i \nyour email is: %s' %(name,age,email)) 4 #更加清晰引用的方法 5 print('your name is: %(name)s \n y

Python学习笔记-打包发布Python模块或程序,安装包

Python模块.扩展和应用程序可以按以下几种形式进行打包和发布: python setup.py获取帮助的方式 python setup.py --help python setup.py --help-commands 所有可以使用的命令,如build,install python setup.py COMMAND --help 获取特定命令的帮助 python setup.py COMMAND --help-formats 获取特定命令支持使用的格式 打包 1.压缩文件(使用distuti

python读书笔记

python有六个标准的数据类型: 1.Number(数字):int,float,bool,complex 2.String(字符串) 3.Tuple(元祖) 4.List(列表) 5.Dictionary(字典) 6.Sets(集合) 迭代器: 迭代器对象从集合的第一个元素开始访问,直到所有的元素被访问完结束.迭代器只能往前不会后退. 两个基本的方法:iter()创建迭代器对象 和 next()输出迭代器下一个元素. 生成器: 函数:  组织好的,可重复使用的,用来实现单一,或相关联功能的代码

Python读书笔记-第三章,四章

第三章 1. 字符串格式化 >>>format="hello %s  %s world" >>>values=('world','hot') >>>print format % values  #也可以接收单个字符串也 也可以用%f %d这类的类似与c的printf 匹配多个参数的时候应该用圆括号 >>>'%s plus %s equals %s'  %(1,1,2) >>>'%010.2f' %

python读书笔记之函数

函数的定义 def square_sum(a+b) c = a**2+b**2 print c 函数的功能是求两个数的平方和 return 可以返回多个值,相当于返回一个tuple return a,b,c 在Python中,当程序执行到return的时候,程序将停止执行函数内余下的语句.return并不是必须的,当没有return, 或者return后面没有返回值时,函数将自动返回None.None是Python中的一个特别的数据类型,用来表示什么都没有,相当于C中的NULL.None多用于关

python读书笔记之循环

for 循环 for 元素 in 序列 for a in [1,2,3,4]: print a 新的python函数range(),用来建立表 idx = range(5) print idx 这个函数的功能是新建一个表.这个表的元素都是整数,从0开始,下一个元素比前一个大1, 直到函数中所写的上限 (不包括该上限本身) while循环 while i < 10 print i i = i + 1 中断循环 continue   # 在循环的某一次执行中,如果遇到continue, 那么跳过这一