设置工作目录文件夹和路径时,无法打开.py fileon cmd

时间:2018-04-03 00:58:28

标签: command-line pycharm

以下是CMD的输出。收到[Errno 2]。注意a.py在python.exe文件夹中,我可以通过py命令启动python。

C:\Users\x\AppData\Local\Programs\Python\Python36>a.py
C:\Users\x\AppData\Local\Programs\Python\Python36\python.exe: can't open file '#': [Errno 2] No such file or directory

C:\Users\x\AppData\Local\Programs\Python\Python36>dir
 Volume in drive C has no label.
 Volume Serial Number is x

 Directory of C:\Users\x\AppData\Local\Programs\Python\Python36

04/02/2018  06:46 PM    <DIR>          .
04/02/2018  06:46 PM    <DIR>          ..
04/01/2018  07:30 PM               600 a.py

12/23/2016  08:09 AM           100,504 python.exe
12/23/2016  08:06 AM            52,888 python3.dll
12/23/2016  08:06 AM         3,555,992 python36.dll
12/23/2016  08:09 AM            98,968 pythonw.exe
12/23/2016  07:10 AM             8,434 README.txt

C:\Users\x\AppData\Local\Programs\Python\Python36>py
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

1 个答案:

答案 0 :(得分:0)

你必须像这样运行

python.exe a.py

或路径设置正确,

python a.py