Node.js 在安装模块的时候报错,缺少python环境。

ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

错误信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
D:\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate>node "D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:103:14)
gyp ERR! stack     at D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:64:11
gyp ERR! stack     at Object.oncomplete (fs.js:107:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok

原因看node-gyp的安装需求,https://github.com/nodejs/node-gyp, 部分剪切如下,可以请求的看到需要安装python2.7(其实2.6也行)python3不行

You can install with npm:

$ npm install -g node-gyp

You will also need to install:

  • On Unix:

    • python (v2.7 recommended, v3.x.x is not supported)

    • make

    • A proper C/C++ compiler toolchain, like GCC

  • On Mac OS X:

    • You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Downloads

    • This step will install gcc and the related toolchain containing make

    • python (v2.7 recommended, v3.x.x is not supported) (already installed on Mac OS X)

    • Xcode

  • On Windows:

    • For 64-bit builds of node and native modules you will also need the Windows 7 64-bit SDK

    • You may need to run one of the following commands if your build complains about WindowsSDKDir not being set, and you are sure you have already installed the SDK:

    • Microsoft Visual Studio C++ 2013 for Windows Desktop (Express version works well)

    • Microsoft Visual Studio C++ 2013 (Express version works well)

    • If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first

    • If you get errors that the 64-bit compilers are not installed you may also need thecompiler update for the Windows SDK 7.1

    • Make sure that you have a PYTHON environment variable, and it is set to drive:\path\to\python.exe not to a folder

    • Python (v2.7.3 recommended, v3.x.x is not supported)

    • Windows XP/Vista/7:

    • Windows 7/8:

    • All Windows Versions

call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x86
call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x64

If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:

$ node-gyp --python /path/to/python2.7

If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:

$ npm config set python /path/to/executable/python2.7

Note that OS X is just a flavour of Unix and so needs pythonmake, and C/C++. An easy way to obtain these is to install XCode from Apple, and then use it to install the command line tools (under Preferences -> Downloads).

所以下载安装Python2.7就行了,记得配环境变量。

56.ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.的更多相关文章

  1. 成功解决gyp verb ensuring that file exists: C:\Python27\python.exe gyp ERR! configure error gyp ERR! sta

    解决问题 gyp verb ensuring that file exists: C:\Python27\python.exegyp ERR! configure errorgyp ERR! stac ...

  2. Error: Can't find Python executable, you can set the PYTHON env variable.

    该错误解决方案. NodeJS安装Npm包时出现错误: npm WARN prefer global node-gyp@3.4.0 should be installed with -g > s ...

  3. npm install 报错,提示`gyp ERR! stack Error: EACCES: permission denied` 解决方法

    m install 报错,提示gyp ERR! stack Error: EACCES: permission denied 猜测可能是因为没有权限读写,ls -la看下文件权限设置情况 [root@ ...

  4. Appium 命令行模式下遇到的问题总结及解决方案 npm ERR! tar.unpack unzip(或者untar) error

    安装了GUI Appium后,卸载删除问题后,使用命令行模式安装. 一. 遇到问题: nalideMacBook-Pro:~ nali$ npm install -g appium npm ERR! ...

  5. [Tips]Fix node.js addon build error: "gyp: binding.gyp not found"

    基于node-gyp写Node.js native addon的时候,碰到一个很恶心的问题. 调用“node-gyp configure”能成功,再调用“node-gyp”时总会报错,最后发现时系统时 ...

  6. android stack error message is Fail to start the plugin

    E: 08-26 16:34:11.934: E/AliSDK(32236): 错误编码 = 1002208-26 16:34:11.934: E/AliSDK(32236): 错误消息 = SDK  ...

  7. npm install Error:EPROTO: protocol error, symlink '../mime/cli.js' -> '/vagrant/src/nodejs/node_modules/express/node_modules/send/node_modules/.bin/mime'

    我在ubuntu上使用npm安装依赖是出现下面错误: npm ERR! Linux 3.13.0-101-genericnpm ERR! argv "/usr/bin/nodejs" ...

  8. Promise is rejected: Error: 2 UNKNOWN: error starting container: API error (404): {"message":"network build-blockchain-insurance-app_default not found"}出错的解决方案

    错误描述: docker logs web 现象: > blockchain-for-insurance@2.1.0 serve /app > cross-env NODE_ENV=pro ...

  9. 解决MyEclipe出现An error has occurred,See error log for more details的错误

    今晚在卸载MyEclipse时出现An error has occurred,See error log for more details的错误,打开相应路径下的文件查看得如下: !SESSION 2 ...

随机推荐

  1. cuda thrust函数首次调用耗费时间比后续调用长原因

    lazy context initialisation. stackoverflow

  2. JAVA程序类加载及其反射机制

    [IT168 技术]当调用java命令运行某个Java程序时,该命令将启动一条Java虚拟机进程,同一个JVM的所有线程,所有变量都处于同一进程里,它们都是用该JVM进程的内存区. 程序运行到最后正常 ...

  3. NodeJS学习笔记 (16)子进程-child_process(ok)

    原文: https://github.com/chyingp/nodejs-learning-guide/blob/master/README.md 自己的跟进学习: 父进程,子进程,线程之间的关系 ...

  4. Open With Atom添加到右键菜单/从右键菜单移除

    1.进入Settings 快捷键ctrl+shift+p,输入settings后回车 2.切换到System选项卡 3.通过勾选/取消勾选以下选项实现添加/移除右键菜单 √ Show in file ...

  5. JS获取当前时间(YYYY-MM-DD ),element显示默认当前时间,显示默认昨天,显示默认上个月

    原文链接:点我 进来的随便看看,或许有帮助 vue+element-ui   datepicker 设置默认日期用的框架是vue+element-ui ,以下是时间控件 <el-form-ite ...

  6. javascript面向对象编程,带你认识封装、继承和多态

    原文链接:点我 周末的时候深入的了解了下javascript的面向对象编程思想,收获颇丰,感觉对面向对象编程有了那么一丢丢的了解了~很开森 什么是面向对象编程 先上一张图,可以对面向对象有一个大致的了 ...

  7. OpenGL 获取当前屏幕坐标对应的三维坐标

    转自原文 OpenGL 获取当前屏幕坐标对应的三维坐标,使用很简单glu库中的一个函数 #include <GL/glut.h> #include <stdlib.h> #in ...

  8. Qt 5.3 下OpenCV 2.4.11 开发(0)图像处理基本概念

    1.普通情况下的RGB彩色图像:它的每一个像素点都是由三个通道组成,即红色(R).绿色(G)和蓝色(B).8位三通道彩色图像就是每一个像素中每一个通道的取值范围都是 0~255(即二进制下的8位数), ...

  9. [Python] numpy fillna() for Dataframe

    In the store marketing, for many reason, one stock's data can be incomplete: We can use 'forward fil ...

  10. js 阻断网页选中和右键

    $(document).bind("contextmenu", function () { return false; }); $(document).bind("sel ...