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

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

问题描述

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

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)下载 Python

1) Download the official version of Python

2)在下面的屏幕快照中使用自定义安装.

2) Use custom installation following the screenshots bellow.

3)通过直接输入 hello.py

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

  • 屏幕截图1

  • 屏幕截图2

  • 截屏#3

  • 只要输入Q60471933.py,我就可以运行此python代码
from datetime import datetime
print("\nHello World\n",datetime.now().strftime("\b%m/%d/%Y\n%H:%M:%S"))


  • 输出:

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

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