ImportError: cannot import name ‘_validate_lengths‘ 解决方法

阅读 113

2022-02-18

numpy版本不匹配,无法导入_validate_lengths,在网上找了很多解决办法,都不好用,只好自己分析。

打开arraycrop.py,问题瞬间解决。。。


# The below functions are retained in comments in case the NumPy architecture
# changes and we need copies of these helper functions for `crop`.
# These are identical to functions in numpy.lib.arraypad.py as of NumPy v1.11

将这段文字下方被注释的函数选中,解除注释,再注释文件开头处,与_validate_lengths相关的import即可。。。

原来python更新时早就考虑到这个问题了,小丑竟是我自己。。。

精彩评论(0)

0 0 举报