一、错误信息
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版本上面报错有
testCase % 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
- 安装成功