安装了face_recognition,但无法导入。 (Python3.64)

时间:2019-01-27 08:47:18

标签: python linux macos computer-vision face-recognition

>>> import face_recognition
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/username/Desktop/face_recognition_low/face_recognition.py", line 30, in <module>
    np.set_printoptions(threshold=np.nan)
  File "/Users/username/.virtualenvs/cv/lib/python3.6/site-packages/numpy/core/arrayprint.py", line 246, in set_printoptions
    floatmode, legacy)
  File "/Users/username/.virtualenvs/cv/lib/python3.6/site-packages/numpy/core/arrayprint.py", line 93, in _make_options_dict
    raise ValueError("threshold must be numeric and non-NAN, try "
ValueError: threshold must be numeric and non-NAN, try sys.maxsize for untruncated representation

昨天导入face_recognition没问题,但是突然间它不起作用。我不知道如何解决此问题。我们将不胜感激。

我重新启动了Mac,现在再次尝试可以正常工作。我想弄清楚为什么...

>>> import dlib
>>> import face_recognition 
>>>

1 个答案:

答案 0 :(得分:2)

请通过import sys导入sys。

然后替换

np.set_printoptions(threshold=np.nan)

使用

np.set_printoptions(threshold=sys.maxsize)