转载自:http://www.letuknowit.com/post/58.html


自己在centos上使用pip安装wxPython模块时,提示不能解压自动下载的bz2包。网上搜了下,问题与该转载文章相似。


在CentOS系统中安装Node.js,遇到如下错误

ImportError: No module named bz2:
  File "/disk/src/node-v0.6.12/deps/v8/SConstruct", line 37:
    import js2c, utils
  File "/disk/src/node-v0.6.12/deps/v8/tools/js2c.py", line 36:
    import bz2
Waf: Leaving directory `/disk/src/node-v0.6.12/out'
Build failed:  -> task failed (err #2):
        {task: libv8.a SConstruct -> libv8.a}
make: *** [program] 错误 1

该错误是因为Python没有bz2扩展,安装下bz2后,再重新安装下python。

yum install -y bzip2*
cd ../Python-2.7.3/Modules/zlib  //转载注:这里应该是作者笔误。在yum安装bzip2包后,需要进入
                                 //python解压的目录,进行下面的python重编译操作
./configure 
make 
make install
cd ../../
python setup.py install

PS:在以上步骤之前,你需要先升级CentOS系统的Python到Python 2.7.3版本

转载请注明:知识蚂蚁  Python 2.7.3安装bz2扩展