Ubuntu 12.04安装nodejs折腾记

      以前在centos上安装,ubuntu安装,从来没有像这次这么折腾,可能是刚来工作单位的原因吧....

         

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

解压、编译

tar xzvf Python-2.7.3
cd Python-2.7.3
./configure
make && make install
 
  

首先下载node最新的源码包

wget http://nodejs.org/dist/v0.8.11/node-v0.8.11.tar.gz

解压,然后开始编译

tar -zxf node-v0.8.11.tar.gz
cd node-v0.8.11
./configure
总之出现了一个以前没有出现的错误,叫
ImportError: No module named bz2
终于让我发现了答案:
 
   

This is related to issue #2316

I followed the README for recent node versions stating that python 2.6 or 2.7 is needed, and then I spent quite a long time before succeeding to compile Python with bz2

Maybe it's specific to my environment and I don't install unix stuff everyday but I think the README desserves at least a mention in case of python/bz2 installation problem and at least links to these two bugs

In my case, it was solved following this :

http://stackoverflow.com/questions/812781/pythons-bz2-module-not-compiled-by-default http://www.kelvinwong.ca/2010/08/02/python-2-7-on-dreamhost/

But both methods are not totally correct (in my case at least), the correct sequence is more something like (sorry for the imprecision but I spent enough time on this, probably some people can correct easily if needed) :

wget http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz tar xpzf bzip2-1.0.6.tar.gz cd bzip2-1.0.6 make -f Makefile_libbz2_so make make install PREFIX=/usr/local cp ./libbz2.so.1.0.6 /usr/local/lib

cd Python-2.7.3 ./configure --prefix=/usr/local make install


你可能感兴趣的:(linux,nodejs)