from PIL import Image 出现version错误

错误如下:

from PIL import Image
D:\Anaconda3\lib\site-packages\PIL\Image.py:116: RuntimeWarning: The _imaging extension was built for another version of Pillow or PIL:
Core version: 5.4.1
Pillow version: 1.1.7
warnings.warn(str(v), RuntimeWarning)
Traceback (most recent call last):
File “D:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py”, line 2963, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 1, in
from PIL import Image
File “D:\PyCharm Community Edition 2018.1.4\helpers\pydev_pydev_bundle\pydev_import_hook.py”, line 19, in do_import
module = self._system_import(name, *args, **kwargs)
File “D:\Anaconda3\lib\site-packages\PIL\Image.py”, line 101, in
version))
ImportError: The _imaging extension was built for another version of Pillow or PIL:
Core version: 5.4.1
Pillow version: 1.1.7

解决方案:参考
from PIL import Image 出现version错误
按以上建议将上述报错文件D:\Anaconda3\lib\site-packages\PIL\Image.py!=符号前面的变量改成core.PILLOW_VERSION,问题解决。
from PIL import Image 出现version错误
from PIL import Image 出现version错误