首页 > 解决方案 > How to make a setup sequence that only runs the first time the program is started

问题描述

I am trying to make some sort of a setup instance (few lines of code), that only runs first time the program is started. I can't rely on fixed directorys, since the program is going to be applied to different systems(Win systems).

Thanks :)

标签: pythoninstallation

解决方案


Use a main function and put this code at the start of your main.

def main():
    # put your code here
    # rest of program here

if __name__ = "__main__":
    main()

I am not sure if this is exactly what you want as your question is pretty vague.


推荐阅读