码迷,mamicode.com
首页 > 编程语言 > 详细

报错:[stack Error: Can't find Python executable "python"] vue项目npm install

时间:2021-01-11 10:40:56      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:one   cut   上下   需要   please   rgb   config   一个   target   

背景:gitee上下载的开源vue项目,本地部署。执行【npm install】时,报错Error: Can‘t find Python executable "python", you can set the PYTHON env variable

解决:

  网上提供的一个解决办法:管理员身份打开cmd 键入【npm install --global --production windows-build-tools】。但是这行命令执行一半不动了,再去执行【npm install】时出现另一个问题error MSB4019: 未找到导入的项目“E:\Microsoft.Cpp.Default.props”,最后参考https://github.com/felixrieseberg/windows-build-tools/issues/175解决了问题!

  

// 这里执行npm install -g --production windows-build-tools其实没有成功的
C:\Windows\system32>npm install -g --production windows-build-tools
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> windows-build-tools@5.2.2 postinstall D:\soft\java\nodejs\node_global\node_modules\windows-build-tools
> node ./dist/index.js

Downloading python-2.7.15.amd64.msi
[>                                            ] 0.0% (0 B/s)
Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\zhangchenxin\.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
[>                                            ] 0.0% (0 B/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\zhangchenxin\.windows-build-tools\vs_BuildTools.exe.

Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

Status from the installers:
---------- Visual Studio Build Tools ----------
2021-01-07T17:09:19 : Verbose : Spawning uninstall stub
2021-01-07T17:09:19 : Verbose : [InstallerImpl]: Rpc connection was closed.
2021-01-07T17:09:19 : Verbose : [InstallerImpl]: Stream was closed
2021-01-07T17:09:19 : Verbose : [SetupUpdaterImpl]: Rpc connection was closed.
2021-01-07T17:09:19 : Verbose : [SetupUpdaterImpl]: Stream was closed
------------------- Python --------------------
Successfully installed Python 2.7终止批处理操作吗(Y/N)? n

//这里 成功了 C:\Windows\system32
>npm install --global windows-build-tools@5.0.0 npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated har-validator@5.1.5: this library is no longer supported > windows-build-tools@5.0.0 postinstall D:\soft\java\nodejs\node_global\node_modules\windows-build-tools > node ./dist/index.js Downloading vs_BuildTools.exe [> ] 0.0% (0 B/s) Downloaded vs_BuildTools.exe. Saved to C:\Users\zhangchenxin\.windows-build-tools\vs_BuildTools.exe. Starting installation... Launched installers, now waiting for them to finish. This will likely take some time - please be patient! Status from the installers: ---------- Visual Studio Build Tools ---------- Successfully installed Visual Studio Build Tools. ------------------- Python -------------------- Python 2.7.15 is already installed, not installing again. Now configuring the Visual Studio Build Tools.. All done! + windows-build-tools@5.0.0 removed 1 package and updated 8 packages in 646.789s
//需要执行配置 C:\Windows\system32
>npm config set msvs_version 2017 C:\Windows\system32>

注意:可能还是不能找到python,去看一下环境变量Path,有没有python27的配置,没有的话需要添加C:\Users\admin\.windows-build-tools\python27


//再去执行 npm install, 成功了!

报错:[stack Error: Can't find Python executable "python"] vue项目npm install

标签:one   cut   上下   需要   please   rgb   config   一个   target   

原文地址:https://www.cnblogs.com/zcx-94/p/14247954.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!