小编JkS*_*haw的帖子

numpy frombuffer - AttributeError:'str'对象没有属性'__buffer__'

Python版本:3.5.2 Numpy版本:1.12.1

错误:

import numpy as np
s = 'Hello World'
np.frombuffer(s, dtype='S1')
AttributeError: 'str' object has no attribute '__buffer__'
Run Code Online (Sandbox Code Playgroud)

事情尝试:

  1. 尝试在线Ideone编译器,在Python3.xx中得到相同的错误.
  2. 称为SciPy的常见问题为numpy的和python兼容版本,其中指出"numpy的支持的Python 2.x的系列,(2.6和2.7版本),以及3.2的Python和更新.NumPy的的第一个版本,以支持Python 3中是NumPy的1.5. 0".

无法弄清楚问题,尝试stackoverflow相同的问题,但没有发现,可能是我错过了它.有关错误的原因以及如何在python3.xx中解决它的任何建议或线索.

numpy python-3.x

10
推荐指数
1
解决办法
5928
查看次数

标签 统计

numpy ×1

python-3.x ×1