pycocotools遇到的坑

pycocotools是在python2的环境下运行

如果在python3中运行:

1、报错:NameError: name 'unicode' is not defined

      错误解析:Python2 的unicode 函数在 Python3 中被命名为 str。在 Python3 中使用 ·str 来代替 Python2 中的 unicode.

     解决方法:在anaconda3/lib/python3.6/site-packages/pycocotools路径下,打开coco.py,将308行替换为

if type(resFile) == str or type(resFile) == bytes:

 2、pycocotools默认运行框架为theano,如果要使用tensorflow

      在pycocotools的文件下的3个.py文件中添加  :

import os
os.environ['KERAS_BACKEND'] = 'tensorflow'

3、报错: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated                       as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters

     这个错误其实不会有任何影响
     如果想让它消失,只需要更新h5py至2.8.0rc1以上

  pip install h5py==2.8.0rc1

猜你喜欢

转载自blog.csdn.net/qq_30159015/article/details/82968932