1. 用python乱序一个数组:
1 >>> from random import shuffle 2 >>> y = [[j] for j in range(100)] 3 >>> shuffle(y) 4 >>> print y 5 [[65], [39], [2], [94], [28], [63], [16], [53], [77], [31], [11], [36], [51], [38], [25], [58], [97], [35], [12], [64], [98], [44], [13], [84], [21], [90], [54], [85], [34], [78], [30], [67], [6], [81], [83], [87], [41], [1], [19], [55], [76], [7], [52], [95], [14], [0], [37], [20], [29], [3], [42], [68], [9], [32], [72], [89], [23], [10], [5], [99], [80], [50], [18], [48], [74], [4], [24], [57], [45], [33], [15], [91], [43], [93], [46], [88], [22], [71], [75], [56], [70], [62], [82], [17], [92], [69], [66], [60], [73], [96], [59], [27], [8], [40], [47], [79], [86], [26], [49], [61]] 6 >>>
2. python包管理:
如果你想对 virtualenv 环境的包进行包管理,那么,
创建virtualenv环境时,请使用 --no-site-packages 标签,标识不与克隆库同package。
virtualenv --no-site-packages online
如果不这样做,则pip处理的所有包均是对克隆体进行修改。最后面会带来很多问题。
http://stackoverflow.com/questions/7976089/pip-virtualenv-django-installation-issue
不需要特殊处理。
安装最新版本的包:
pip install pyOpenSSL
安装指定版本的包:
pip install -v pyOpenSSL==0.13
pip uninstall pyOpenSSL
pip freeze
http://pip.readthedocs.org/en/latest/reference/pip_uninstall.html