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
您没有在Python shell中键入“from ex48 import lexicon”,而是在命令行中键入了它from”是列出邮件发件人的命令,因此是/var/mail位置。
从命令产生的不同错误消息可以看出这一点:
您需要将shebang添加到程序的第一行。放入
#!/usr/bin/python
或python bin所在的位置,程序将运行。相关问题 更多 >
编程相关推荐