Hi Amit,
I had the same problem and found that it was because swift expects python 2.7 and was finding my 3.6.5 version.
To solve the problem I installed Anaconda3 and did a conda create -n py2 python=2.7
followed by conda activate py2
to ensure the script ran under 2.7.
Hope this helps,
Tim