码迷,mamicode.com
首页 > 其他好文 > 详细

ImportError: cannot import name 'izip & TypeError: 'float' object cannot be interpreted as an integer

时间:2018-08-12 12:19:29      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:ror   comm   cnn   cto   pre   clean   group   rto   python3.x   

  • ImportError: cannot import name ‘izip‘

参考:https://codereview.stackexchange.com/questions/26271/import-izip-for-different-versions-of-python

A common idiom that I use for Python2-Python3 compatibility is:

gedit mtcnn_detector.py

try:
    from itertools import izip
except ImportError:  #python3.x
    izip = zip

However, a comment on one of my Stack Overflow answers implies that there may be a better way. Is there a more clean way to accomplish this?

  • TypeError: ‘float‘ object cannot be interpreted as an integer

将报错的部分全部用int()包起来,强制进行类型转化

ImportError: cannot import name 'izip & TypeError: 'float' object cannot be interpreted as an integer

标签:ror   comm   cnn   cto   pre   clean   group   rto   python3.x   

原文地址:https://www.cnblogs.com/pprp/p/9462056.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!