在Archlinux中进行软件降级

天升级Archlinux的时候,发现Python有2.6.3-2的更新,便立刻升级了。谁知更新完就立马出现了问题,在调用logging的时候会出现如下错误:

root# ipython
Python 2.6.3 (r263:75183, Oct  4 2009, 11:40:05)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from logging import *
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/usr/lib/python2.6/<ipython console> in <module>()

AttributeError: 'module' object has no attribute 'NullHandler'

使用包管理器升级软件包是一件愉悦的事情,不过如果出现这样的错误便恼人了。乍一看pacman的手册里并没有找到降级的办法,但是想到pacman还有指定包文件来安装的参数,一个降级的办法就找到了。可是怎么找到之前的包文件呢?

前阵子更新了pacman后经常出现下载错误把几K的文件下载成几个G的情况,报错的文件都存放在/var/cache/pacman/pkg/中,所以就尝试在这个目录下list | grep python,运气不错,立刻找到了上一个版本的安装文件。然后使用pacman -U <文件名>来安装降级,终于一切又都回归了。

现在想想,还好从来没有执行过pacman -Scc,不然要降级的话困难度又加大了不少。至于经验么,除非非常确定没有降级的必要,之前的软件包还是都留着以防万一吧……

发表评论

评论备注:

  1. 留言时的头像是Gravatar提供的服务。
  2. By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution. So, you don't fully own your words, so to speak.