首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >尝试从Powershell运行Python程序时,Powershell提示返回提示,但不返回python输出

尝试从Powershell运行Python程序时,Powershell提示返回提示,但不返回python输出
EN

Stack Overflow用户
提问于 2018-07-24 03:52:45
回答 1查看 3.3K关注 0票数 0

我正在尝试从powershell运行python,我使用以下命令转到python目录

代码语言:javascript
复制
cd f:\python27

如果我输入python,我会得到以下错误(尽管它是文件夹中的exe文件):

代码语言:javascript
复制
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!“

我试着把两个都打出来

代码语言:javascript
复制
python helloworld.py
.\python helloworld.py

第一个返回原来的错误,第二个返回提示符,显然没有做任何事情,我不能让python程序运行。我是Powershell和Pyton的新手,我正在努力通过艰难的方式学习python,有谁能帮助我或指出我哪里错了,并解释我做错了什么,解决方案是什么?谢谢

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51486307

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档