How to run python file with admin rights in pycharm
Simply run the PyCharm shortcut as administrator, and then PyCharm terminal will run with admin privileges.
See these images for referral,
For Desktop PyCharm Shortcut
For Start menu search of PyCharm Shortcut
Startup pycharm as Administrator then all scripts will be ran as administrator.
From Windows start menu right click the Pycharm shortcut and select 'Run as administrator.' Optionally create a short and change the options to always Run as Administrator under the "Compatibility" tab.