Python Lex-Yacc:
*Getting Started with PLY
To install PLY on your machine for python2/3, follow the steps outlined below:
ply-3.10 folder
python setup.py install
If you completed all the above, you should now be able to use the PLY module. You can test it out by opening a python interpreter and typing import ply.lex.
Note: Do not use pip to install PLY, it will install a broken distribution on your machine.