numpy.getbuffer导致AttributeError:'模块'对象没有属性'getbuffer' [英] numpy.getbuffer causes AttributeError: 'module' object has no attribute 'getbuffer'
本文介绍了numpy.getbuffer导致AttributeError:'模块'对象没有属性'getbuffer'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从Python 3中的一个numpy数组中获取一个缓冲区. 我发现以下代码:
I want to get a buffer from a numpy array in Python 3. I have found the following code:
$ python3
Python 3.2.3 (default, Sep 25 2013, 18:25:56)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> a = numpy.arange(10)
>>> numpy.getbuffer(a)
但是在最后一步会产生错误:
However it produces the error on the last step:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getbuffer'
我为什么做错了? 该代码对Python 2正常工作. 我正在使用的numpy版本是1.6.1.
Why am I doing wrong? The code works fine for Python 2. The numpy version I'm using is 1.6.1.
推荐答案
查看全文