zoukankan      html  css  js  c++  java
  • 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
    
    > snappy@5.0.5 install C:codemyprj
    ode_modulessnappy
    > node-gyp rebuild
    
    
    C:codemyprj
    ode_modulessnappy>if not defined npm_config_node_gyp (node "C:Program Files
    odejs
    ode_modules
    pmin
    ode-gyp-bin\....
    ode_modules
    ode-gypin
    ode-gyp.js" rebuild )  else (node "" rebuild )
    gyp ERR! configure error
    gyp ERR! stack Error: Can't find Python executable "C:UsersjunAppDataLocalProgramsPythonPython36", you can set the PYTHON env variable.
    gyp ERR! stack     at PythonFinder.failNoPython (C:Program Files
    odejs
    ode_modules
    pm
    ode_modules
    ode-gyplibconfigure.js:483:19)
    gyp ERR! stack     at PythonFinder.<anonymous> (C:Program Files
    odejs
    ode_modules
    pm
    ode_modules
    ode-gyplibconfigure.js:508:16)
    gyp ERR! stack     at C:Program Files
    odejs
    ode_modules
    pm
    ode_modulesgraceful-fspolyfills.js:284:29
    gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
    gyp ERR! System Windows_NT 6.1.7601
    gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
    gyp ERR! cwd C:codemyprj
    ode_modulessnappy
    gyp ERR! node -v v8.1.3
    gyp ERR! node-gyp -v v3.6.2
    gyp ERR! not ok
    
    > deasync@0.1.9 install C:codemyprj
    ode_modulesdeasync
    > node ./build.js

    大致意思是python没有环境变量,但实际上已经安装了python也配置了环境变量,可就是解决不了。

    如果遇到这种情况检查一下python版本是不是3.x的。如果是,那就是版本导致的错误。卸载掉3.x安装2.7的即可解决。

    python-2.7.3下载地址:

    https://npm.taobao.org/mirrors/python/2.7.3/python-2.7.3.msi

    另外补充一点。

    node-gye还需要vc++和.netFramework4.5支持。

    详细如下:

    https://github.com/nodejs/node-gyp

    On Windows
    
    Option 1
    
    Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).
    
    Option 2
    
    Install tools and configuration manually:
    
    Visual C++ Build Environment:
    
    Option 1: Install Visual C++ Build Tools using the Default Install option.
    
    Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.
    
    :bulb: [Windows Vista / 7 only] requires .NET Framework 4.5.1
    Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7 (or see below for further instructions on specifying the proper Python version and path.)
    
    Launch cmd, npm config set msvs_version 2015
    
    If the above steps didn't work for you, please visit Microsoft's Node.js Guidelines for Windows for additional tips.
    
    If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:
    致读者:感谢你阅读本文,请随手点击右下角的推荐或分享,谢谢!
  • 相关阅读:
    [QT_QML]qml假如调试信息 qDebug console.debug
    [QT_FFMPEG]学习问题: 刚开始移植ffmpeg,测试时出现 undefined reference to `avcodec_configuration()'
    [QT_OPENCV] qt下opencv配置以及首个opencv工程
    [QT][SQLITE]学习记录二 日期查询
    [QT][DEMO] QTableWidget 设置某一列禁止编辑
    [QT][SQLITE]学习记录一 querry 查询
    [QT]QPixmap图片缩放和QLabel 的图片自适应效果对比
    [QT]问题记录-QPixmap::scaled 缩放不成功
    利用php给图片添加文字水印--面向对象与面向过程俩种方法的实现
    利用javascript实现文本的自动输出
  • 原文地址:https://www.cnblogs.com/yzeng/p/7205473.html
Copyright © 2011-2022 走看看