简体   繁体   English

安装依赖项时出现python问题

[英]Problem with python while installing dependencies

I'm learning node.js and the tutorial im watching included a code but when I execute npm install on the project directory I get the following error:我正在学习 node.js 并且我正在观看的教程包含一个代码,但是当我在项目目录上执行npm install时,我收到以下错误:

gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Users\work-\AppData\Local\Programs\Python\Python37-32\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\work-\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

Seems like python is not installed properly?好像python没有正确安装? While installing python there will be a checkbox like Add python 3.8 to PATH.在安装 python 时,会有一个复选框,如 Add python 3.8 to PATH。 Check the regedit to check the path.检查regedit以检查路径。

here version might differ这里的版本可能有所不同

Looks like you don't have python installed on your machine.看起来你的机器上没有安装python。

Go to command prompt and type转到命令提示符并键入

python Python

if you get something like this:如果你得到这样的东西:

Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>>

If you don't get this, that means you don't have python installed on your machine.如果你没有得到这个,那意味着你的机器上没有安装 python。

You can also try commands like你也可以尝试像这样的命令

python3蟒蛇3

But in the end, you should see a similar result that I provided above.但最终,您应该会看到我在上面提供的类似结果。

Another way to check if you have python installed try enter following command:检查是否安装了 python 的另一种方法尝试输入以下命令:

Mac/Linux Mac/Linux

which python哪条蟒蛇

Windows视窗

where python哪里蟒蛇

If you have python installed it will print you location where it's installed如果你安装了 python,它会打印你安装它的位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM