为什么我的导入时间给出错误模块对象不可调用

Mat*_*ton 3 python time

我只想使用导入时间函数从python获取时间戳.

import time
Run Code Online (Sandbox Code Playgroud)

我有这个示例测试代码,它在云9上运行得很好.

import time
now = int(time.time() * 1000)
print now
Run Code Online (Sandbox Code Playgroud)

但它在我的Mac上不起作用.我在第1行得到了一个错误.

Python 2.7.11 (default, Mar 21 2016, 23:21:56) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] 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 2, in <module>
    now = int(time.time() * 1000)
TypeError: 'module' object is not callable
>>> 
Run Code Online (Sandbox Code Playgroud)

不确定这里发生了什么令人沮丧.

Dan*_*man 6

您的本地目录中有一个名为"time.py"的文件.重命名它.