gentoo卸载Python导致emerge不能使用解决方法
今天一不小心把Python给卸载掉了,导致emerge不能使用,最终找到如下解决方案:
wget http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tar.bz2\
tar xjvf Python-2.4.4.tar.bz
cd Python-2.4.4
./configure –with-fpectl –infodir=/usr/share/info/ –mandir=/usr/share/man
make
make install prefix=/usr
rm /usr/bin/python 2>/dev/null
ln -s /usr/bin/python2.4 /usr/bin/python2
ln -s /usr/bin/python2 /usr/bin/python
然后在emerge -av python
,将Python更新就ok了。
相关文档:
Python中可以使用装饰器对函数进行装饰(或说包装),利用这个特性,可以很方便、简洁地解决一些问题,比如获得函数执行时间的问题。
首先,我们定义一个函数,如下:
def exeTime(func):
def newFunc(*args, **args2):
t0 = time.time()
print "@%s, {%s} start" % (time.strftime("%X", time.local ......
在讲述filter,map和reduce之前,首先介绍一下匿名函数lambda。
lambda的使用方法如下:lambda [arg1[,arg2,arg3,...,argn]] : expression
例如:
>>> add = lambda x,y : x + y
>>> add ......
#!/usr/bin/env python """
HMM module This module implements simple Hidden Markov Model class. It follows the description in
Chapter 6 of Jurafsky and Martin (2008) fairly closely, with one exception: in this
implementation, we assume that all states are initial states. @author: R ......
Pythonwin - Python IDE and GUI Framework for Windows.
Copyright 1994-2006 Mark Hammond
Python is Copyright (c) 2000-2008 ActiveState Software Inc.
Copyright (c) 2001-2008 Python Software Foundation.
All Rights Reserved.
Copyright (c) 2000 BeOpen.com.
All Rights Reserved.
Copyright (c) 1995-20 ......