- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在关注文档:https://pillow.readthedocs.io/en/stable/
我用 pip 成功安装了 Pillow。但是,当我尝试导入 Image
函数时,我可以:
a) 仅从 PIL 导入b) 只得到没有模块 PIL
的错误c) 得到没有模块 Pillow
这是消息(当我尝试使用 Pillow 而不是 PIL 时会发生同样的事情):
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
这是我使用 pip 安装它的证据:
Requirement already satisfied: Pillow in c:\python310\lib\site-packages (8.4.0)
我在 Stackoverflow 上读到 PIL 不再维护。但是,没有问题回答我的问题: ImportError: No module named PIL
最佳答案
您可能在与您使用的 Python 安装不同的 Python 安装中安装了 Pillow。 pip
和 python
相互链接。让我们先确定您使用的是什么命令。
Q1 - 您使用什么命令来运行 Python 脚本?
您在启动 Python 脚本时使用什么命令?或者,如果您使用图形 IDE,例如VS Code、JetBeans、IDLE,它使用什么命令来启动 Python?
可能的答案:
所以,如果答案是 python3
,那么在答案的其余部分中,YOURPYTHON
将是 python3
。
Q2 - 你使用什么命令来安装 Python 包?
你使用什么命令来安装 Python 包?
可能的答案:
因此,如果答案是 pip3
,那么在答案的其余部分中,YOURPIP
将是 pip3
。
您已将 pip
安装到您的 Python 310 安装中,您可以在 “满足要求” 消息中看到这一点,或者通过运行:
YOURPIP -V # quick version check
YOURPIP show pillow # more detail as to location
YOURPIP debug # lots of detail about how pip is set up
现在的问题是您使用的是哪个 Python?它在哪里寻找?
YOURPYTHON -V # quick version check
YOURPYTHON -c "import sys; print(sys.executable)" # where is my Python interpreter?
YOURPYTHON -c "import sys; print('\n'.join(sys.path))" # where does it look for packages?
一般来说,如果你使用python
,你可能应该使用pip
。但是如果你使用 python3
,你可能应该使用 pip3
来确保你安装到你的解释器正在寻找的同一个地方。
当您键入如下命令时,您可以获得有关实际运行的信息:
which python # works on macOS, Linux and Windows
type python # works on macOS and Linux and is preferable
关于尽管安装了 PIP,Python Pillow(或 PIL)仍无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69822301/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 6年前关闭。 Improve this qu
我有实体: @Entity @Table(name = "CARDS") public class Card { @ManyToOne @JoinColumn(name = "PERSON_I
我正在尝试计算二维多边形的表面法线。我正在使用 OpenGL wiki 中的 Newell 方法来计算表面法线。 https://www.opengl.org/wiki/Calculating_a_S
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 7 年前。 Improve
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 9 年前。 Improve this
我这里有以下 XML: Visa, Mastercard, , , , 0, Discover, American Express siteonly, Buyer Pay
即将发生的 Google 政策变更迫使我们实现一个对话框,以通知欧盟用户有关 Cookie/设备标识符用于广告和分析的情况。我只想向欧盟用户显示此对话框。我不想使用额外的权限(例如 android.p
本文分享自华为云社区《华为大咖说 | 企业应用AI大模型的“道、法、术” ——道:认知篇》,作者:华为云PaaS服务小智。 本期核心观点 上车:AGI是未来5~10年内,每个人都无法回避的技
我有一个与酒精相关的网站,需要先验证年龄,然后才能让他们进入该网站。我使用 HttpModule 来执行此操作,该模块检查 cookie,如果未设置,我会将它们重定向到验证页面。我验证他们的年龄并存储
在欧盟,我们有一项法律,要求网页请求存储 cookie 的许可。我们大多数人都了解 cookie 并同意它们,但仍然被迫在任何地方明确接受它们。所以我计划编写这个附加组件(ff & chrome),它
以下在 C 和/或 C++ 中是否合法? void fn(); inline void fn() { /*Do something here*/ } 让我担心的是,第一个声明看起来暗示函数将被定义
我是一名优秀的程序员,十分优秀!