I am new to Python.
I try to install PIL using Python 3.5.2 shell.
pip install PIL
SyntaxError: invalid syntax
pip install --no-index -f http://dist.plone.org/thirdparty/ -U PIL
You should run the
pip command from a system terminal (BASH prompt), not from inside Python. Normally you would open /Applications/Utilities/Terminal.app, and then type
pip install PIL. If that installs packages for Python 2.7 instead of 3.5, you could try this instead:
python3 $(which pip) install PIL.
Or from within Python 3.5 you could try this (from Installing python module within code):
import pip pip.main(['install', 'PIL'])
A longer-term solution would be to install pip to work with Python 3.5 instead of 2.7. To do that, you would run these commands from the system terminal:
curl --remote-name https://bootstrap.pypa.io/get-pip.py python3 get-pip.py
pip install PIL should install PIL in your 3.5 installation.