2009/02/06

安装Ubuntu 8.10 带来的问题

Ubuntu 8.10: firefox中flash无声音
解决: sudo apt-get install flashplugin-nonfree-extrasound

启动我的python程序,多了如下两个bugs. :-(

/usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module _mysql was already imported from /var/lib/python-support/python2.5/_mysql.so, but /var/lib/python-support/python2.5 is being added to sys.path
from pkg_resources import resource_stream

import MySQLdb
import matplotlib
会出现 UserWarning, 但顺序
import matplotlib
import MySQLdb
则不会

解释: matplotlib may import mySQLdb and a warning message is issued if mySQLdb already is imported.
而 /usr/lib/python2.5/site-packages/pytz has to do with timezones. python-tz ( pytz: python time zone)

解决方法:
1。 简易。 调整 import 顺序.
2. or look into
/usr/lib/python2.5/site-packages/pytz/__init__.py:29
找到 pkg_resources.py, 修改该文件。
/usr/lib/python2.5/site-packages/pkg_resources.py, Line 2272:

From:
if fn and normalize_path(fn).startswith(loc):
To:
if fn and (fn.startswith(loc) or normalize_path(fn).startswith(loc)):

the warning goes away.




/usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module dateutil was already imported from /var/lib/python-support/python2.5/dateutil/__init__.py, but /var/lib/python-support/python2.5 is being added to sys.path
from pkg_resources import resource_stream

这个好像与 旧的pyc文件没有 update有关,It may be caused by outdated *.pyc files. Can try (sudo python -c 'import dateutil') - that should regenerate
outdated *.pyc files. 第二个warning消失.


/usr/lib/python2.5/site-packages/CGAL/__init__.py:3: RuntimeWarning: Python C API version mismatch for module Kernel: This Python has API version 1013, module Kernel has version 1012.
from Kernel import *
/usr/lib/python2.5/site-packages/CGAL/__init__.py:4: RuntimeWarning: Python C API version mismatch for module Triangulations_2: This Python has API version 1013, module Triangulations_2 has version 1012.
from Triangulations_2 import *
/usr/lib/python2.5/site-packages/CGAL/__init__.py:5: RuntimeWarning: Python C API version mismatch for module Triangulations_3: This Python has API version 1013, module Triangulations_3 has version 1012.
from Triangulations_3 import *

这个与 CGAL 版本落后有关, 按 cgal-python version = 0.9.3 ,python=2.5 重新自己编译. OK. (参见 cgal-python安装)


当然 Ubuntu 8.10也带来一个pylab/matplotlib的好处: pylab绘图完成后会将控制权返回,因此可以在一个canvas上interactive plotting. 以前必须关闭canvas返回。

没有评论: