简体   繁体   中英

installed face_recognition, but cannot import. (Python3.64)

>>> 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

There was no problem importing face_recognition yesterday but all of sudden it does not work. I have no idea how to fix this problem... Any assistance would be highly appreciated.

I restarted my mac and tried again now it works fine. I would like to figure out why...

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

Please import sys by import sys .

Then replace

np.set_printoptions(threshold=np.nan)

with

np.set_printoptions(threshold=sys.maxsize)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM