shaoheshaohe 发表于 2019-10-23 00:32:12

ImportError: cannot import name '_validate_lengths'

ImportError: cannot import name '_validate_lengths’错误, 如图:

Traceback (most recent call last):
File "C:/Users/Administrator/Desktop/detect_steel_number/samples/gangjin/gangjin.py", line 35, in <module>
    import skimage.draw
File "C:\ProgramData\Anaconda3\lib\site-packages\skimage\__init__.py", line 158, in <module>
    from .util.dtype import *
File "C:\ProgramData\Anaconda3\lib\site-packages\skimage\util\__init__.py", line 7, in <module>
    from .arraycrop import crop
File "C:\ProgramData\Anaconda3\lib\site-packages\skimage\util\arraycrop.py", line 8, in <module>
    from numpy.lib.arraypad import _validate_lengths
ImportError: cannot import name '_validate_lengths'

解决方法,重新安装一下scikit-image库。出现上述错误的原因是由于在安装imgaug库的过程中,numpy库的版本变了,所以导致错误。
conda install scikit-image
1
运行成功,


注意: pip install scikit-image -i https://pypi.tuna.tsinghua.edu.cn/simple同样成功

页: [1]
查看完整版本: ImportError: cannot import name '_validate_lengths'