【发布时间】:2018-07-23 19:52:44
【问题描述】:
我正在尝试从 powershell 运行 python,我转到 python 目录使用
cd f:\python27
如果我输入 python,我会收到以下错误(尽管它是文件夹中的 exe 文件):
python : The term 'python' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ python
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (python:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command python was not found, but does exist in the
current location. Windows PowerShell does not load commands from the current
location by default. If you trust this command, instead type: ".\python". See "get-
help about_Command_Precedence" for more details.
如果我输入 .\python 它什么也不做,并再次返回提示。我在文本编辑器中创建了一个名为 helloworld.py 的简单文件,并将其保存到 python27 目录中,其中包含一行:
打印“Hello World!”
我都试过了
python helloworld.py
.\python helloworld.py
第一个返回原始错误,第二个返回提示,显然没有做任何事情,我无法让 python 程序运行。我是 Powershell 和 Pyton 的新手,我正在努力通过艰难的方式学习 python,任何人都可以帮助或指出我哪里出错并解释我做错了什么以及解决方案是什么?谢谢
【问题讨论】:
-
Running Python in PowerShell? 和其他几个的可能重复项。
标签: python powershell