How to run python code as administrator ? | Sololearn: Learn to code for FREE!


How to run python code as administrator ?

Python manually need to run as administrator how can i achieve this plse help ?

7 Answers

New Answer


K.Boopathi Where do you want to run your program? and on which platform? I mean from command prompt or in IDE? On Windows from command prompt, use runas command syntax : runas / user:administrator e.g runas /user:administrator notepad or launch the command prompt as administrator itself. then any program launched from the shell will runas administrator. From IDE: run the IDE as administrator itself then run the code from IDE. On linux/unix from terminal run python code as "su" or "sudo"


~ swim ~ i need to overwrite a file that need administrator permission


rajesh kumar when run your code it show no module What i need to do


~ swim ~ i need that Python automatically run as administrator


K.Boopathi In your question you have written "python manually needs to run as administrator" ! Anyways can you be more specific what you are trying to do? Are you , through your code trying to access some resource on your machine that requires admin level access and wants that happens automatically?


K.Boopathi Some solutions here


K.Boopathi Ok. I now assume rajesh kumar answer provides you a solution you were looking for.