使用随机库在python中生成随机整数失败

使用随机库在python中生成随机整数失败,python,random,Python,Random,以下是片段: C:\APPS>python Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import random >>> random.seed() Traceback (most

以下是片段:

C:\APPS>python
Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> random.seed()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'seed'
>>> random.randint(0,3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'randint'
>>>
C:\APPS>python
Python 2.7.5(默认值,2013年5月15日,22:44:16)[MSC v.1500 64位(AMD64)]在win上
32
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>随机输入
>>>random.seed()
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
AttributeError:“模块”对象没有属性“种子”
>>>random.randint(0,3)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
AttributeError:“module”对象没有属性“randint”
>>>

您可能在
APPS
目录中有一个名为
random.py
的文件。删除或重命名该文件。

APPS
目录中可能有一个名为
random.py
的文件。删除或重命名该文件。

尝试以下操作以查看您正在使用的随机模块:

In [1]: import random

In [2]: print(random.__file__)
/usr/lib/python3.2/random.py

尝试以下方法,查看您正在使用的随机模块:

In [1]: import random

In [2]: print(random.__file__)
/usr/lib/python3.2/random.py

您是否有其他名为
random
的模块?我尝试过,但没有任何错误。您是否有其他名为
random
的模块?我尝试过,但没有任何错误。