如何在Mac上将PIL安装到Python 3.5? [英] How to install PIL to Python 3.5 on a mac?

查看:93
本文介绍了如何在Mac上将PIL安装到Python 3.5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am very new to Python installations and trying to install PIL. I have a feeling they are being installed to the wrong directory. PIP seems to have been installed fine.

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'.

但是,在签入终端机时,回复为

However when checking in terminal the reply is

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

它还提到了另一版本的Python.

Its also mentions a different version of Python.

当Pycharm仍提出未解决的参考时,最好的安装PIL的方式是什么?

How would the best way to install PIL be as Pycharm is coming up with unresolved reference still?

推荐答案

在您的命令行上:

$ which python

我敢打赌这会返回:

/Library/Python/2.7/site-packages

/Library/Python/2.7/site-packages

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

This shows your 'basic' Python (which comes preinstalled on Mac) location. Now do:

$ which python3

如果显示以下内容:

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

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

然后检查pip3版本:

$ which pip3

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

If that exists and has a similar location to python3, then try this:

$ pip3 install Pillow

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

If that works, there is a good chance PyCharm will now pick up the correct installation.

这篇关于如何在Mac上将PIL安装到Python 3.5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆