from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (F:\ANACONDA3\envs\ffdnet-pytorch\lib\site-packages\PIL\__init__.py)
时间: 2023-07-21 21:22:30 浏览: 109
这个错误的原因是你导入了PIL库中不存在的PILLOW_VERSION模块。请注意,在Pillow 8.3.0及更高版本中,这个模块已被删除。相反,你可以使用`PIL.__version__`来获取版本号。
你可以尝试使用以下代码来获取版本号:
```python
import PIL
print(PIL.__version__)
```
如果你需要检查Pillow是否已安装,可以运行以下代码:
```python
try:
import PIL
except ImportError:
print("Pillow is not installed.")
```
相关问题
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'
这个错误通常是由于 PIL 版本较旧导致的。您可以尝试更新 PIL 或 Pillow(PIL 的一个分支)版本来解决此问题。
您可以使用以下命令更新 Pillow:
```
pip install --upgrade Pillow
```
如果您使用的是 PIL,请使用以下命令更新:
```
pip install --upgrade PIL
```
如果您已经安装了 Pillow,但仍然遇到此错误,请确保您的代码中没有导入 PIL,并且只导入了 Pillow。例如:
```
from PIL import Image
```
应该改为:
```
from Pillow import Image
```
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (D:\Anaconda\envs\meng\lib\site-packages\PIL\__init__.py)
这个错误是由于Python库PIL中的PILLOW_VERSION引起的。根据引用[1]和引用的信息,它们都提到了PIL库中的PILLOW_VERSION无法导入。为了解决这个问题,可以尝试使用方法二中提到的替换方法。即将文件中的"from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION"这句代码替换为"from PIL import Image, ImageOps, ImageEnhance, __version__",然后保存文件。这样就可以解决ImportError中的PILLOW_VERSION错误。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)