python - 无法从“PIL”错误中导入名称“_imaging”
问题描述
我在我的 python 项目中使用 Pillow-6.1.0,我试图在其中导入 ImageGrab() 函数,但是我不断收到以下错误:
cannot import name '_imaging' from 'PIL'
我目前正在使用 Python 3.7 并在 Visual Studios 上编辑代码(不确定 IDE 是否可能参与错误,因为我没有太多经验)
我也在运行 Windows,所以我看到的一些需要 Linux 的解决方案对我不起作用。
我试过的:
卸载并重新安装 Pillow
删除 Python37-32/Lib/site-packages 文件夹中带有“PIL”的所有内容并卸载 Pillow 并重新安装
将 Pillow 模块直接移动到我的项目文件夹中
将 ImageGrab.py 直接移动到我的项目文件夹中
更新了我的枕头模块
我所有重新安装 Pillow 都是通过 pip 命令
其他可能相关的信息:
ImageGrab() 不是我无法导入的唯一模块,我也无法导入 Image 模块
我可以成功导入 PIL 模块,但无法通过 IDE 中的“from PIL import some_PIL_module”命令访问其中的模块
当我通过 Visual Studios IDE 运行我的代码时,如果我直接在 python 终端中输入命令“from PIL import ImageGrab”,它会成功运行而没有错误
这是在我的代码中给我错误的行
from PIL import ImageGrab;
我希望它可以毫无问题地导入,但我收到以下错误:
cannot import name '_imaging' from 'PIL'
解决方案
推荐阅读
- excel - VBA代码搜索下一个非空单元格的列,向上移动1个单元格并将某些内容粘贴到其中..直到完成
- go - 在 Alpine 中找不到 runtime/cgo
- ios - 获取 JSON 数据并将其解析为使用 Decodables。但我收到一些错误“无法读取数据,因为它的格式不正确”
- scala - Spark 中 Vectors.dense 数组中的数组
- java - 使用 Spring WebClient 发出多个请求
- node.js - Swageer js doc 不会即时更新 api 文档的更改?
- python - 如何用不同形状的数组展平一个 numpy 对象数组?
- jquery - 使用织物生成画布图像
- docker - 为什么 Docker 运行失败?exec 用户进程导致“没有这样的文件或目录”
- reactjs - 我如何在反应地图中的两个按钮之间切换禁用