一、錯誤信息
ImportError: dlopen(/Users/menghuiding/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so, 0x0002): tried:
'/Users/menghuiding/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-
38-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')),
'/System/Volumes/Preboot/Cryptexes/OS/Users/menghuiding/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so' (no such file),
'/Users/menghuiding/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
二、原因
python安裝錯位置,調用不到,則需要重新安裝
三、解決方案
找到python安裝位置,python版本上面報錯有
root@MacBook-Pro% which python3.8
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
安裝
sudo /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
-m pip install --force-reinstall matplotlib
安裝成功