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

Jam*_*ons 2 python macos python-imaging-library

我是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'.
Run Code Online (Sandbox Code Playgroud)

但是在检查终端时回复是

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

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

安装PIL的最佳方法是什么,因为Pycharm仍然会提出未解决的参考?

Nat*_*ord 9

在您的命令行上:

$ which python
Run Code Online (Sandbox Code Playgroud)

我打赌这会回来:

/Library/Python/2.7/site-packages

这显示了您的"基本"Python(预装在Mac上)的位置.现在做:

$ which python3
Run Code Online (Sandbox Code Playgroud)

如果这表明:

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

然后检查pip3版本:

$ which pip3
Run Code Online (Sandbox Code Playgroud)

如果存在且位置相似python3,请尝试以下操作:

$ pip3 install Pillow
Run Code Online (Sandbox Code Playgroud)

如果工作,有一个很好的机会PyCharm现在拿起正确安装.