Follow the below steps:
1. Install python in your system. Visit below for installing python
2. Then Go to Power BI -> Options &Settings -> Options - > Preview features - >Tick mark for Python.
If python script is already enabled then you can see the default location in the path folder of python in Python Scripting Options
3. Now Click on Python script in Power BI visualisation tab on right side of the screen.
4. Click on python to run Python script in Power BI.