How can I switch the python version from 3.6.7 to 2.7.13?

For some purposes,I need the python 2.7.13 in Slicer to make some old code work.
Is there anyone have done this thing before?
Any help is appreciate.

Recent preview versions of Slicer switched to Python3 and we will not ever go back to Python2. You need to make minor changes to your Python2 modules to make them compatible with Python3 as described in this topic: