0

我是 python 新手,现在正在熟悉命令提示符。我正在尝试在我的根结构 (/python) 的文件夹 (/asmt-01) 中打开counting.py 文件。我通过notepad ++测试了我的python,它运行正常。但是,我无法单独通过命令提示符运行此脚本。我有以下脚本。我究竟做错了什么?另外,是否有任何资源可以帮助我理解 python 用户的命令提示符?我感谢任何建议和帮助,谢谢。

C:\Users\Maria\Desktop\python>dir


 Directory of C:\Users\Maria\Desktop\python

09/09/2013  12:23 AM    <DIR>          .
09/09/2013  12:23 AM    <DIR>          ..
09/08/2013  09:42 PM    <DIR>          asmt-01
09/08/2013  08:35 PM                19 firstprog.py
               1 File(s)             19 bytes
               3 Dir(s)  605,589,807,104 bytes free

C:\Users\Maria\Desktop\python>dir asmt-01

 Directory of C:\Users\Maria\Desktop\python\asmt-01

09/08/2013  09:42 PM    <DIR>          .
09/08/2013  09:42 PM    <DIR>          ..
09/08/2013  09:57 PM                37 counting.py
               1 File(s)             37 bytes
               2 Dir(s)  605,589,577,728 bytes free

C:\Users\Maria\Desktop\python>python counting.py
python: can't open file 'counting.py': [Errno 2] No such file or directory

C:\Users\Maria\Desktop\python>
4

2 回答 2

4

执行使用C:\Users\Maria\Desktop\python>python asmt-01\counting.py

您可以在此处了解有关 Windows 命令提示符的更多信息http://www.cs.princeton.edu/courses/archive/spr05/cos126/cmd-prompt.html

于 2013-09-09T04:49:57.687 回答
0

我遇到了同样的问题,您应该从 Microsoft 商店下载 Python,然后尝试运行它会提示使用哪个应用程序打开此文件,选择您现在安装的 Python(您可以选择 Idle 或 Python cmd)

于 2021-11-19T05:28:04.920 回答