I'm newbie in python program. I use MacBook Pro M2, Mac Monterey 12.4 and visual studio to program. But every time I import Torchvision or numpy I always get message:
import torchvision
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torchvision/__init__.py", line 2, in <module>
from torchvision import datasets
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torchvision/datasets/__init__.py", line 1, in <module>
from .lsun import LSUN, LSUNClass
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torchvision/datasets/lsun.py", line 2, in <module>
from PIL import Image
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/Image.py", line 100, in <module>
from . import _imaging as core
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/PIL/_imaging.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
I have spent a lot of time to research but no solution is work.
It seems that you have installed the wrong package version. Please select the appropriate version according to your PC.
At the same time, the official recommendation is to use the conda environment.
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.