找不到python的节点gyp
我正在尝试npm install
用于我的Mac中的一个项目,但由于某种原因,即使python3
命令都无法正常工作,但我也没有找到python,我还将别名python设置为python3在〜/.zshrc
和〜/.bash-profile
中,并重新启动了几次,但仍然存在同一问题。
该问题的屏幕截图。
注意:请参阅解决方案的评论
I am trying to npm install
for a project in my mac but for some reason it says python not found even though python3
command is working fine and I also set alias python to python3 in by ~/.zshrc
and ~/.bash-profile
and restarted several times but still the same issue.
Screenshot of the issue.
NOTE: See comments for the solution
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题在于,在系统路径中需要Python才能操作此命令。解决方案:
pyenv
pyenv install 2.7.18
或pyenv install 3.9.11
(例如)> pyenv global 3.9.11
pyenv
到您的系统路径〜/.bashrc
或〜/.zshrc
:export path = $(pyenv root)/shims:$ path
,然后运行源〜/.bashrc
或source〜/.zshrc
npm配置设置Python C:\ library \ Python \ Python310 \ Python.exe
(例如)通过管理员npm安装
再次The problem is that Python is required in the system path to operate this command. Solutions:
pyenv
pyenv install 2.7.18
orpyenv install 3.9.11
(for example)pyenv global 3.9.11
pyenv
to your system path~/.bashrc
or~/.zshrc
:export PATH=$(pyenv root)/shims:$PATH
, then runsource ~/.bashrc
orsource ~/.zshrc
npm config set python C:\Library\Python\Python310\python.exe
(for example) via administratornpm install
again