2011-11-06 27 views

回答

11

您沒有在Python shell中鍵入「from ex48 import lexicon」,而是在命令行鍵入它。 「from」是列出郵件來自哪裏的命令,因此是/ var/mail位置。

您可以從命令產生不同的錯誤信息告訴這一點:

localhost-2:~ $ from ex48 import lexicon 
from: can't read /var/mail/ex48 
localhost-2:~ $ python 
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from ex48 import lexicon 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named ex48 
+0

那麼你是說我把它輸入lexicon.py文件?我如何運行我的詞典遊戲掃描儀(ex49)? – chacha

23

你需要的家當添加到您的程序的第一道防線。放入#!/usr/bin/python或您的python bin所在的位置,並且您的程序將運行。

+1

它不是一個腳本,他在提示符下運行它 –

相關問題