萨拉姆(手段你好):)
我有terminal访问VPS运行centos 5.9和默认的Python 2.4.3安装。 我也通过这些命令安装了Python 2.7.3:(我用make altinstall
代替make install
)
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz tar -xf Python-2.7.3.tgz cd Python-2.7.3 ./configure make make altinstall
然后我通过这些命令从源代码安装node.js:
python2.7 ./configure make make install
问题是,当我使用npm install
并尝试安装需要python> 2.4.3的node.js包时,我得到这个错误:
gyp ERR! configure error gyp ERR! stack Error: Python executable "python" is v2.4.3, which is not supported by gyp. gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0. gyp ERR! stack at failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:125:14) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:114:9
我应该如何“通过 – python开关指向Python> = v2.5.0” ?
Wa Alikom Al Salam纳赛尔=)
如果你的$ PATH中有python2.7,你可以直接从命令'$ python 2.7'来发出它,试试把它作为参数–python:
$ npm --python python2.7 install
如果它不工作尝试使用python2.7的完整path
$ npm --python /usr/bin/python2.7 install