如何在 mac 上将 PIL 安装到 Python 3.5?

How to install PIL to Python 3.5 on a mac?

我对 Python 安装非常陌生,正在尝试安装 PIL。我有一种感觉,它们被安装到错误的目录中。 PIP 似乎已经安装好了。

Pycharm 说

Try to run this command from the system terminal. Make sure that you
use the correct version of 'pip' installed for your Python interpreter
located at
'/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'.

但是在终端检查时,回复是

Jamess-MacBook-Pro:~ JamesParsons$ pip install Pillow
Requirement already satisfied (use --upgrade to upgrade): Pillow in
/Library/Python/2.7/site-packages

它还提到了 Python 的不同版本。

安装 PIL 的最佳方式是什么,因为 Pycharm 仍然有未解决的参考?

在您的命令行中:

$ which python

我打赌这个 returns:

/Library/Python/2.7/site-packages

这显示了您的 'basic' Python(预装在 Mac 上)的位置。现在做:

$ which python3

如果这样显示:

/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'

然后检查 pip3 版本:

$ which pip3

如果存在并且位置与 python3 相似,那么试试这个:

$ pip3 install Pillow

如果 有效,PyCharm 现在很有可能会选择正确的安装。