您可能在与您正在使用的 Python 安装不同的 Python 安装中安装了 Pillow。pip
and python
是相互关联的。让我们首先确定您正在使用哪些命令。
Q1 - 您使用什么命令来运行 Python 脚本?
启动Python脚本时使用什么命令?或者,如果您使用图形 IDE,例如VS Code, JetBeans, IDLE,它使用什么命令来启动Python?
可能的答案:
- python
- python-2.7
- python3
所以,如果答案是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