4
在Snow Leopard上運行python,我無法導入'時間'模塊。在ipython中工作。沒有任何正在加載的.pythonrc文件。使用相同解釋器的「輸入時間」的腳本運行良好。不知道如何解決這個問題。任何人有想法?不能在python中導入時間,得到'AttributeError:struct_time'如何解決?
[[email protected] ~]$ python2.6
Python 2.6.6 (r266:84292, Sep 1 2010, 14:27:13)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "time.py", line 4, in <module>
t = now.strftime("%d-%m-%Y-%H-%M")
AttributeError: struct_time
>>>
[[email protected] ~]$ ipython-2.6
Python 2.6.6 (r266:84292, Sep 1 2010, 14:27:13)
Type "copyright", "credits" or "license" for more information.
IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import time
In [2]:
就是這樣,感謝您的快速反應。我有一個隨機腳本,我在幾天前測試了我當前的工作目錄中的time.py。移動它解決了這個問題。 – wiggles 2010-10-22 22:00:39