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

  • 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()包起来,强制进行类型转化

猜你喜欢

转载自www.cnblogs.com/pprp/p/9462056.html