- An error
I was at the time of Digital Recognition with Pytorch, because the program is introduced with torchvision
this module, follow the prompts to find an error in the past, we found an error occurred in the torchvision \ transforms \ functional.py in on this one
from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
- the reason
Checked the reasons is because
In 7.0.0:
PILLOW_VERSION
has been removed. Use__version__
instead.Quoted from https://github.com/python-pillow/Pillow/issues/4130#issuecomment-570453802
I tried for torchvision
this module has been updated, the results of my current version is up to date, it did not update this writing.
- Install a lower version of
In this case, there is a way to uninstall Pillow, and then re-install an older version of
pip uninstall Pillow # 卸载当前pillow
pip uninstall PIL # 可能还需要卸载这个模块
pip install Pillow==版本号 # 有些教程说6.1版本的可用
I have not practice for reference purposes only
- Modify the module file
I made a bold operation, I took part in the import PILLOW_VERSION of functional.py to change the
from PIL import Image, ImageOps, ImageEnhance, __version__
Vision will be a warning to modify in Pycharm, verify that you can modify the
But only this is not enough, as used in the following procedure or PILLOW_VERSION
variable, and then I made such an operation
PILLOW_VERSION=__version__
Note that this sentence should be placed before the statement PILLOW_VERSION all variables used, I was put in the sentence immediately following the import operation after all
In summary, my problem was resolved