[jetson]jetson上报错from numpy.lib.arraypad import _validate_lengthsImportError: cannot import name ‘_

报错:

Traceback (most recent call last):
  File "server.py", line 6, in
    from TaskManager import *
  File "/home/nvidia/lu/anjian_ocr_server/TaskManager.py", line 4, in
    from DetManager import *
  File "/home/nvidia/lu/anjian_ocr_server/DetManager.py", line 13, in
    from ppocr.data import create_operators, transform
  File "/home/nvidia/lu/anjian_ocr_server/ppocr/data/__init__.py", line 23, in
    import skimage
  File "/usr/lib/python3/dist-packages/skimage/__init__.py", line 158, in
    from .util.dtype import *
  File "/usr/lib/python3/dist-packages/skimage/util/__init__.py", line 7, in
    from .arraycrop import crop
  File "/usr/lib/python3/dist-packages/skimage/util/arraycrop.py", line 8, in
    from numpy.lib.arraypad import _validate_lengths
ImportError: cannot import name '_validate_lengths'
解决放方法:

sudo vi /usr/lib/python3/dist-packages/skimage/util/arraycrop.py

修改如下:屏蔽from numpy.lib.arraypad import _validate_lengths然后加入

#from numpy.lib.arraypad import _validate_lengths
from distutils.version import LooseVersion as Version
old_numpy = Version(np.__version__) < Version('1.16')
if old_numpy:
    from numpy.lib.arraypad import _validate_lengths
else:
    from numpy.lib.arraypad import _as_pairs
还有一种方法就是更换Numpy版本

你可能感兴趣的:(jetson,numpy,python,开发语言)