2017-03-04 123 views
-3

我無法從cmd promt打開一個shell。 PIP的作品,我可以鍵入一些命令,但不斷得到錯誤。python:無法打開文件'hello_world':[Errno 2]沒有這樣的文件或目錄

Directory of C:\Python27 

03/03/2017 08:07 PM <DIR>   . 
03/03/2017 08:07 PM <DIR>   .. 
03/03/2017 07:23 PM <DIR>   DLLs 
03/03/2017 07:23 PM <DIR>   Doc 
03/03/2017 08:07 PM <DIR>   dojopython 
03/03/2017 07:23 PM <DIR>   include 
03/03/2017 07:52 PM <DIR>   Lib 
03/03/2017 07:23 PM <DIR>   libs 
05/23/2015 10:29 AM   38,584 LICENSE.txt 
05/23/2015 10:23 AM   418,960 NEWS.txt 
05/23/2015 09:44 AM   26,624 python.exe 
05/23/2015 09:44 AM   27,648 pythonw.exe 
05/10/2015 06:01 PM   53,986 README.txt 
03/03/2017 07:36 PM <DIR>   Scripts 
03/03/2017 07:23 PM <DIR>   tcl 
03/03/2017 07:23 PM <DIR>   Tools 
       5 File(s)  565,802 bytes 
       11 Dir(s) 183,884,189,696 bytes free 

C:\Python27>python # 
python: can't open file '#': [Errno 2] No such file or directory 
+0

你想做什麼? – AJPennster

+0

只需鍵入'python',你的'hello_world'文件在哪裏 – Bijoy

+0

C:\ Python27 \ dojopython>它不會讓我打開它的錯誤以及通過python打開一個shell# –

回答

0

的語法是:

python <python script> 

考慮以下 - foo.py存在,但bar.py並不:

$ ls foo.py bar.py 
ls: bar.py: No such file or directory 
foo.py 
$ 

現在,這將引發相同作爲您的錯誤:

$ python bar.py 
python: can't open file 'bar.py': [Errno 2] No such file or directory 
$ 

而這個作品:

$ python foo.py 
hello world! 
$ 

注:打字只是 '蟒蛇'(沒有任何python腳本)將推出你加載Python解釋器交互的shell。 另外,我上面的例子使用Unix環境,而你的是Windows。儘管如此,相同的語法仍適用。

相關問題