SyntaxError: future feature annotations is not defined

报错信息:

  File "predict.py", line 9, in <module>
    from PIL import Image
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
  File "/home/nvidia/.local/lib/python3.6/site-packages/Pillow-9.2.0-py3.6-linux-aarch64.egg/PIL/Image.py", line 52, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 894, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1157, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1131, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1112, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 441, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 544, in spec_from_file_location
  File "/home/nvidia/.local/lib/python3.6/site-packages/Pillow-9.2.0-py3.6-linux-aarch64.egg/PIL/_deprecate.py", line 1
SyntaxError: future feature annotations is not defined

怀疑是python版本和pillow的版本不匹配导致

原环境:python==3.6+pillow==9.2.0

对pillow降级变为pillow==8.4.0解决

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐