问题描述
在运行程序的时候报错:
Traceback (most recent call last):
File "demo_heat_map.py", line 2, in <module>
import heatmap
File "/home/xxx/PycharmProjects/ObjectDetection/Dataset_Build/heatmap-master/heatmap/__init__.py", line 1, in <module>
from .heat_map import add
File "/home/xxx/PycharmProjects/ObjectDetection/Dataset_Build/heatmap-master/heatmap/heat_map.py", line 4, in <module>
from skimage import transform
File "/home/xxx/anaconda3/lib/python3.6/site-packages/skimage/__init__.py", line 158, in <module>
from .util.dtype import *
File "/home/xxx/anaconda3/lib/python3.6/site-packages/skimage/util/__init__.py", line 7, in <module>
from .arraycrop import crop
File "/home/xxx/anaconda3/lib/python3.6/site-packages/skimage/util/arraycrop.py", line 8, in <module>
from numpy.lib.arraypad import _validate_lengths
ImportError: cannot import name '_validate_lengths'
原因分析
版本问题,numpy版本过高,_validate_lengths被移除或者改名
解决方法
降低numpy的版本:
pip install numpy==1.15.0