我已经安装了终端访问运行centos 5.9和默认python 2.4.3的VPS。我还通过以下命令安装了Python2.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”
发布于 2014-03-16 14:40:19
您可以像这样使用npm的--python
选项:
npm install --python=python2.7
或将其设置为始终使用:
npm config set python python2.7
Npm会在需要时将此选项传递给node-gyp。
(注意:我是在Github上开了一个问题的人,因为有太多关于它的问题;-)
发布于 2013-12-08 22:04:33
在运行npm安装之前将python设置为python2.7
Linux:
export PYTHON=python2.7
Windows:
set PYTHON=python2.7
发布于 2015-08-16 02:32:53
对于Windows用户来说,类似这样的东西应该可以工作:
PS C:\angular> npm install --python=C:\Python27\python.exe
https://stackoverflow.com/questions/20454199
复制相似问题