如何在 Windows 10 命令提示符下运行 python 程序 [英] How to run a python program in Windows 10 command prompt

查看:47
本文介绍了如何在 Windows 10 命令提示符下运行 python 程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行我的 hello world 程序时遇到这样的错误:

<块引用>

此文件没有与之关联的程序来执行此操作"

解决方案

1) 下载

  • 屏幕截图 #2

  • 屏幕截图 #3

<小时>
  • 我只需输入 Q60471933.py 即可运行此 Python 代码

from datetime import datetimeprint("
Hello World
",datetime.now().strftime("%m/%d/%Y
%H:%M:%S"))

<小时>

  • 输出:

I am getting as such error for executing my hello world program:

"This file does not have a program associated with it for performing this action"

解决方案

1) Download the official version of Python

2) Use custom installation following the screenshots bellow.

3) Run your hello.py file directly from the command line by typing hello.py

  • Screenshots #1

  • Screenshots #2

  • Screenshots #3


  • I have this python code that I'm running on just by typing Q60471933.py

from datetime import datetime
print("
Hello World
",datetime.now().strftime("%m/%d/%Y
%H:%M:%S"))


  • Outputs:

这篇关于如何在 Windows 10 命令提示符下运行 python 程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆