找不到Python executab

2024-04-26 05:42:40 发布

您现在位置:Python中文网/ 问答频道 /正文

Error: Can't find Python executable "D:\Python", you can set the PYTHON env variable. at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)

我确实在D:\Python中安装了python(2.7.14),并且设置了环境变量enter image description here

我也试过SET PYTHON=D:\Python

命令行中的命令可以正常工作。

python.exeD:\Pythonenter image description here

我做错什么了?


Tags: theenvyoumodulesnodeerrorfindvariable
1条回答
网友
1楼 · 发布于 2024-04-26 05:42:40

结果是node-gyp不接受windows环境中的变量,您必须这样设置它们:

npm config set python D:\python

我安装的是sharp,而不是node-gyp,这就是为什么我没有注意他们的文档,其中包含以下命令:

npm install --global --production windows-build-tools

它将为您安装所有内容并设置路径。我使用了这个命令,最后成功地运行了npm install

注意:您需要以管理员身份运行此命令

相关问题 更多 >