简体   繁体   English

为什么在py运行时python命令没有在powershell中调用python解释器

[英]why python command does not invoke python interpreter in powershell though py is working

I am using windows 10 operating system. 我正在使用Windows 10操作系统。 I had downloaded and installed Ananconda python 3.6 version for windows 64 bit. 我已经下载并安装了Windows 64位的Ananconda python 3.6版本。

I had added Anaconda to windows path manually. 我已经将Anaconda手动添加到Windows路径。 The current path is as below. 当前路径如下。

I have also added the PYTHONPATH variable. 我还添加了PYTHONPATH变量。 在此处输入图片说明

The command py launches the python interpreter as below. py命令如下所示启动python解释器。 在此处输入图片说明

But the command python fails with below error. 但是命令python失败并显示以下错误。

在此处输入图片说明

How do I fix the issue. 我该如何解决此问题。 I am trying to run a simple hello World on sublime text but the same is failing with below error. 我正在尝试在崇高的文本上运行一个简单的hello World,但同样失败,并出现以下错误。

'python' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.0s with exit code 1]
[shell_cmd: python -u "D:\Python_Test\testprinting.py"]
[dir: D:\Python_Test]

I could not figure out the exact reason why python was not being recognized as a command even thought the path C:\\ProgramData\\Anaconda3\\ was added to the path variable with and without quotes "". 我什至不知道为什么无法将python识别为命令的确切原因,甚至认为路径C:\\ ProgramData \\ Anaconda3 \\被添加到带有和不带有引号“”的路径变量中。 I reinstalled the Anaconda3 package and then manually added the path. 我重新安装了Anaconda3软件包,然后手动添加了路径。 This time python command invokes the interpreter and its working fine in sublime text. 这次python命令调用解释器,并且它在sublime文本中正常工作。

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

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