Installing Node.js in the CentOS system encountered the following error
The code is as follows |
Copy Code |
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] Error 1 |
The error is because Python does not have bz2 extensions, install BZ2, and then reinstall Python.
The code is as follows |
Copy Code |
Yum Install-y bzip2* Cd.. /python-2.7.3/modules/zlib ./configure Make Make install Cd.. /.. / Python setup.py Install |
add: because the CentOS default version is python2.4 so we can refer to the following methods to upgrade in place python2.7.3 can oh.
The following starts compiling the Python 2.7.3 version
The code is as follows |
Copy Code |
Wget-c http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2--no-check-certificate Tar jxvf python-2.7.3.tar.bz2 CD Python-2.7.3 ./configure Make Make install |
The default installation path for python2.7 is/usr/local/lib/python2.7, after the installation is complete, check to see if the version is correct
The code is as follows |
Copy Code |
$/usr/local/bin/python2.7-v Python 2.7.3 |
Normally, even if the python2.7 installation is successful, the system's default pointing Python is still 2.4.3, so you need to point the system's default Python to version 2.7 because the Yum in CentOS is based on python2.4.3 to work properly, so do not uninstall Python 2.4.3 version.
The code is as follows |
Copy Code |
Mv/usr/bin/python/usr/bin/python.bak Ln-s/usr/local/bin/python2.7/usr/bin/python |
Verify the Python point is successful
The code is as follows |
Copy Code |
$ python-v Python 2.7.3 |
Python defaults to the 2.7 release, the way to ensure that Yum can work correctly
Open/usr/bin/yum, the first line of the display #/usr/bin/python modified to #/usr/bin/python2.4 (let Yum or to call python2.4), save the changes can be.