首页 > 解决方案 > AttributeError:模块“numpy”没有属性“byte”

问题描述

得到错误:AttributeError:模块'numpy'没有属性'byte'

我是 python 新手,我只是尝试下面显示的一些代码。我不明白为什么我会收到这个错误,我什至没有import numpy

import os
import json
import skimage

dataset_dir = "C:\\Users\\LIMU\\PycharmProjects\\test1\\datasets"
json_path = "C:\\Users\\LIMU\\PycharmProjects\\test1\\json"

# 读取json
annotations = json.load(open(os.path.join(json_path, "1.json")))
polygons = annotations['shapes']
image_path = os.path.join(dataset_dir, annotations['imagePath'])
image = skimage.io.imread(image_path)
height, width = image.shape[:2]

我希望得到图像的高度和宽度,并且图像的路径在 json 文件中。但显然,我编码错误。

我的英语很差,请多多包涵。先谢谢了。XD

标签: python-3.7

解决方案


我有同样的错误,并通过卸载 numpy 并再次安装来解决它。也在这里检查:如何修复 AttributeError:模块 'numpy' 没有属性 'square'


推荐阅读