[英]Attribute error: “module 'numpy.random' has no attribute 'uniform' ”
[英]numpy.random has no attribute 'choice'
我使用python 2.7.2 | EPD 7.1-1(64位),由於某種原因numpy.random.choice無法正常工作:
從終端窗口:
d-108-179-168-72:~ home$ python
Enthought Python Distribution -- www.enthought.com
Version: 7.1-1 (64-bit)
Python 2.7.2 |EPD 7.1-1 (64-bit)| (default, Jul 3 2011, 15:56:02)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "packages", "demo" or "enthought" for more information.
>>> import numpy as np
>>> np.random.choice(5, 3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'choice'
對問題可能是什么的任何想法?
謝謝
我認為它可能是您的發行版使用的numpy版本。 從文檔中選擇僅在1.7.0中添加,並且從enthought包中我可以看到它在版本7.2中只有1.6.1,比您自己的版本晚。 您可能希望升級您的numpy版本。
它有randint
嗎?
np.random.randint(0,5,3)
應該做同樣的事情
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.