ImportError: cannot import name ‘_validate_lengths‘

错误信息:

 

Traceback (most recent call last):

from skimage import io

File "/home/Anconda3/envs/face_alignment/lib/python3.6/site-packages/skimage/__init__.py", line 167, in

from .util.dtype import (img_as_float32,

File "/home/Anconda3/envs/face_alignment/lib/python3.6/site-packages/skimage/util/__init__.py", line 8, in

from .arraycrop import crop

File "/home/Anconda3/envs/face_alignment/lib/python3.6/site-packages/skimage/util/arraycrop.py", line 8, in

from numpy.lib.arraypad import _validate_lengths

ImportError: cannot import name '_validate_lengths'

网上绝大多数回答是:

numpy版本太高,对numpy进行重新安装:

pip install numpy==1.15.0

但是降低版本会引来其他很多问题,因此我认为这不是很好的解决方式。

解决办法:

  • 出现上述错误的原因是由于在安装其他库的过程中,numpy库的版本变了,所以导致错误。因此,只需升级一下scikit-image库。
pip install -U scikit-image

你可能感兴趣的:(tensorflow,python)