1

Windows上找不到可执行的Python

 1 year ago
source link: https://www.daguanren.cc/post/windows_python_not_found.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
07月29, 2019

Windows上找不到可执行的Python

使用node-canvas组件找不到python运行环境

canvas这个组件很强大,H5、小程序、node都可以使用它。但node环境下还是需要满足特定的条件才能使用node-canvas的,在windows系统中,安装node-canvas前需要有python环境,否则直接安装canvas可能会出现如下错误:

gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "C:\Users\<youruser>\AppData\Local\Programs\Python\Python37-32\python.EXE", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\<project-path>\node_modules\node-gyp\lib\configure.js:483:19) gyp ERR! stack at PythonFinder.<anonymous> (C:\<project-path>\node_modules\node-gyp\lib\configure.js:508:16) gyp ERR! stack at C:\<project-path>\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21taggerscript

问题就是出在Node 在系统中找到不Python的环境变量。

  • (可选) 从官网安装Python:https://www.python.org/
  • 打开命令行,以管理员的身份运行以下命令安装 VS Build Tools 和 Python 2.7
npm install --global --production windows-build-tools

安装windows-build-tools成功后会显示:

alt

全局安装node-gyp:

npm install node-gyp

大功告成。重启命令行,重新安装node-canvas包,应该就没有什么问题了。

https://catalin.me/how-to-fix-node-js-gyp-err-cant-find-python-executable-python-on-windows/

本文链接:https://www.daguanren.cc/post/windows_python_not_found.html

-- EOF --

作者 daguanren

发表于 2019-07-29 17:27:31

,添加在分类 技术分享 Python

,并被添加「 npm Node.js Python 」标签

,最后修改于 2019-07-29 17:28:08

版权归本网站的作者所有,转载请注明出处,谢谢大家。 问题咨询和商务合作请发送邮件至[email protected]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK