ImportError: The _imaging extension was built for another version of Pillow or PIL:
pillow版本问题
·
本机环境是:
1.python3.8通过Anaconda安装的
2.pillow已经安装了,version 9.2.0
解决办法:
网上的一些办法是修改该路径下的文件:D:\anaconda3\Lib\site-packages\PIL\image.py
找到:
if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
raise ImportError("The _imaging extension was built for another "
"version of Pillow or PIL:\n"
"Core version: %s\n"
"Pillow version: %s" %
(getattr(core, 'PILLOW_VERSION', None),
PILLOW_VERSION))
把"if PILLOW_VERSION" 改为"if core.PILLOW_VERSION"
但是这是适用于3.6版本的,3.8版本的文件不适用
对应3.8版本的python需要进行如下操作:
重新安装一下pillow即可
(pytorch) C:\Users\CT>pip uninstall Pillow
Found existing installation: Pillow 9.2.0
Uninstalling Pillow-9.2.0:
Would remove:
d:\anaconda3\envs\pytorch\lib\site-packages\pil\*
d:\anaconda3\envs\pytorch\lib\site-packages\pillow-9.2.0-py3.8.egg-info
Proceed (Y/n)? y
Successfully uninstalled Pillow-9.2.0
(pytorch) C:\Users\CT>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pillow
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8f/59/97618ad67fc0639ed588c60cfe9d91417f7bae8c87bbe7c7784b0ffdb9f1/Pillow-9.2.0-cp38-cp38-win_amd64.whl (3.3 MB)
---------------------------------------- 3.3/3.3 MB 7.5 MB/s eta 0:00:00
Installing collected packages: pillow
Successfully installed pillow-9.2.0
(pytorch) C:\Users\CT>
更多推荐
已为社区贡献1条内容
所有评论(0)