This error occurs because your python version is not compatible with pyspark version. So check your python version and update accordingly using the below given command.
$ sudo ln -s /usr/bin/python3 /usr/bin/python
After that it will work.
To know more about it, get your Pyspark certification today and become expert.