can';t';导入时间';在python中,获取';AttributeError:struct#u time';如何解决?

can';t';导入时间';在python中,获取';AttributeError:struct#u time';如何解决?,python,time,import,Python,Time,Import,在雪豹上运行python,我无法导入“time”模块。在伊皮顿工作。没有加载任何.pythonrc文件。使用同一解释器“导入时间”的脚本运行良好。我不知道如何解决这个问题。有人有主意吗 [wiggles@bananas ~]$ 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", "copyrigh

在雪豹上运行python,我无法导入“time”模块。在伊皮顿工作。没有加载任何.pythonrc文件。使用同一解释器“导入时间”的脚本运行良好。我不知道如何解决这个问题。有人有主意吗

[wiggles@bananas ~]$ 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
>>> 
[wiggles@bananas ~]$ 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]: 
[wiggles@bananas~]$python2.6
Python 2.6.6(r266:8429220010年9月1日,14:27:13)
[GCC 4.2.1(苹果公司建造5646)(dot 1)]关于达尔文
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>导入时间
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“time.py”,第4行,在
t=now.strftime(“%d-%m-%Y-%H-%m”)
AttributeError:结构时间
>>> 
[wiggles@bananas~]$ipython-2.6
Python 2.6.6(r266:8429220010年9月1日,14:27:13)
有关详细信息,请键入“版权”、“信用”或“许可证”。
IPython 0.10——一种增强的交互式Python。
?         -> 介绍和概述IPython的功能。
%快速参考->快速参考。
帮助->Python自己的帮助系统。
对象?->有关“对象”的详细信息?对象也可以工作??打印更多。
In[1]:导入时间
在[2]中:

查找名为time.py的文件。看起来Python正在导入,而不是从标准库导入:

  File "time.py", line 4, in <module>


就这样,谢谢你的快速回复。几天前,我在当前工作目录中测试了一个名为time.py的随机脚本。移动它解决了这个问题。
In [1]: import time    
In [2]: time.__file__   
In [3]: time     # This shows the path as part of the repr