简体   繁体   中英

How to run a python program in Windows 10 command prompt

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("\nHello World\n",datetime.now().strftime("\b%m/%d/%Y\n%H:%M:%S"))

  • Outputs: 在此处输入图片说明

在你的命令提示符中试试这个:

python3 hello.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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