在做人脸特征点检测时用python写的如下几行代码,一直运行有问题。
运行一直报 所划红线所在行出现“ TypeError: slice indices must be integers or None or have an __index__ method”的错误,百度了一下,网上大概分析造车这个错误的原因是 数据的格式问题。
可能存在问题1:
如错误是出现在带除法的那行,那么需要你将除法符号" /"更改成“ //”。

可能存在问题2:
跟我问题一样,如下,“[]”中的数据变成了浮点数,不能作为数组的下标了,需要将数据强制转换为int整型类型。即int(你要转换的数据)

参考:
http://www.mobibrw.com/2017/7322
https://stackoverflow.com/questions/42646915/typeerror-slice-indices-must-be-integers-or-none-or-have-an-index-method

TypeError: slice indices must be integers or None or have an __index__ method相关推荐

  1. 成功解决TypeError: slice indices must be integers or None or have an __index__ method

    成功解决TypeError: slice indices must be integers or None or have an __index__ method 目录 解决问题 解决思路 解决方法 ...

  2. Python:Python3错误提示TypeError: slice indices must be integers or None or have an __index__ method解决办法

    Python:Python3错误提示TypeError: slice indices must be integers or None or have an __index__ method解决办法 ...

  3. TypeError: slice indices must be integers 数组索引必须是整数

    数组索引 错误描述:数组索引必须是整数,cols/2可能是浮点数 解决方法:将cols/2 , 改为cols//2, 因为在python中 / 为浮点数除法,// 为整数除法. 6.2 / 2.0 = ...

  4. “TypeError: list indices must be integers or slices, not str”有关报错解决方案

    "TypeError: list indices must be integers or slices, not str"有关报错解决方案 参考文章: (1)"TypeE ...

  5. 成功解决TypeError: tuple indices must be integers or slices, not str

    成功解决TypeError: tuple indices must be integers or slices, not str 目录 解决问题 解决思路 解决方法 解决问题 TypeError: t ...

  6. Python错误:TypeError: string indices must be integers

    在项目遇到一个错误 : TypeError: string indices must be integers 由于是返回的接口数据,所以一时也分辨不出是哪里的错,然后我就还原了这样的场景: unico ...

  7. 解决TypeError: string indices must be integers, not str

    遇到问题 ExtendValue = {"area": "1","info": "{\"year\": 201 ...

  8. python二维数组读取数报错TypeError: list indices must be integers or slices, not tuple

    如果直接使用如下方法构造二维数据: test_list = [[0] * 5 for _ in range(5)] 取数时报错TypeError: list indices must be integ ...

  9. TypeError: string indices must be integers

    1.错误描述 >>> print(st[-1,-6]); Traceback (most recent call last):File "<pyshell#13> ...

最新文章

  1. *** FATAL ERROR: too many grib files .. 1st=F:\data\预测数据 2nd=- ***
  2. ftp连接 java.net.ConnectException: Connection refused
  3. java forkjoin 简书_浅谈Java的Fork/Join并发框架
  4. 基于9款CSS3鼠标悬停相册预览特效
  5. 一个文件合成器的代码
  6. python编程语言继承_Python面向对象程序设计类的封装与继承用法示例
  7. java 字符串查找程序_java-如何在JAR文件中搜索字符串
  8. 载波聚合或双连接的方式进行_首发天玑1000+!iQOO Z1来了:5G+5G双卡双待、双WiFi 6...
  9. sql server oracle特点,SQL Server 和 Oracle 以及 MySQL 有哪些区别
  10. 服务器cpu对游戏的支持,多核服务器性能实测篇―浪潮:服务器cpu玩游戏怎么样...
  11. torch GPU分布式训练 模型并行
  12. python手册app_Python 中文手册离线版下载_Python3.6中文手册CHM下载 Python3.6中文手册CHM 免费版_当载软件站...
  13. java初级开发面试题
  14. pc端js在线预览Word、Excel
  15. markdown文本居中
  16. 亚马逊自然语言NLP 商品评论智能分析 demo及开发过程 【1 总体API介绍】【持续更新中】
  17. android网络编程记事本,基于android记事本的设计与开发开题报告
  18. MFC界面编程基础(01):Windows 编程模型
  19. 360无线网怎么没有网络连接到服务器,360路由器设置成二级路由器教程 | 192路由网...
  20. windows内网的情况下如何访问外网

热门文章

  1. 详解线上gitlab服务搭建(字数2w+)
  2. Fragment CATION2安卓
  3. C语言学习必看的N本书(一定要看呵)
  4. 软件测试工程师在职研究生,​运维工程师考在职研究生有什么报考条件?
  5. 数字信号处理基础----快速傅里叶变换
  6. Map 集合的删除 按键删除 按值删除
  7. 写一个预测双色球的代码
  8. 代码技巧——dubbo泛化调用
  9. 为什么阿里巴巴超级喜欢java开发?
  10. #21天学习挑战赛#Python入门之mac安装第三方模块——详细教程