python-3.7 - 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
解决方案
我有同样的错误,并通过卸载 numpy 并再次安装来解决它。也在这里检查:如何修复 AttributeError:模块 'numpy' 没有属性 'square'
推荐阅读
- android - Android Studio 冻结,工具栏分离
- git - 获取关联的 JIRA 状态关闭的分支名称
- c# - 我应该为批量异步 GET 请求使用多个 HttpClients 吗?
- android - 在智能手机上离线使用自定义谷歌操作
- ruby-on-rails - Postgres 连接失败,使用系统用户而不是 database.yml 中提供的用户
- assembly - mov r64, m64 是一个周期还是两个周期的延迟?
- docker - 如何使用 CondaDependencies 更改 Azure 机器学习 sdk ContainerImage 中的 Python 版本
- ruby - 当页眉在页面上不可见时,Ruby 单击表头
- javascript - 如何在Javascript中匹配相同的字符串?
- go - Golang 中的取消模式