11

TL;DR I need a module which will automatically update my script in the background, silently.

I'm have a Python script which I distribute to users. I frequently update this, and then ask them to update it (via PIP). Obviously, this isn't a high priority for users, who just want to use the app, not think about updating it.

I'd like it to update my app automatically, like Google Chrome does, silently, in the background, automatically. Is there a library that allows me to do this already? If not, is there a straightforward way to use the PIP/distribute module to do it?

4

3 回答 3

4

如果 pip install 已经为你工作了,为什么你不能os.system("pip install -U myscript")在脚本启动时做呢?这有点脏,但通过 pip 为非开发人员分发也是如此。

于 2011-09-12T21:33:23.590 回答
1

The easiest way to do this is to set up a web service which the script pings when it is run. The web service can return a version number, which the script can check against its own version number. If the version number is higher, it can update itself and re-run.

于 2011-09-12T18:37:15.490 回答
1

我已经为我正在开发的开源应用程序尝试了BitRock 。它们为具有自动更新的应用程序提供跨平台安装程序。如果您的应用程序是开源的,则许可是免费的,但商业产品需要购买许可证。如果您的应用程序很小,这可能有点矫枉过正,但我​​认为我仍然会将其作为一种选择。

于 2011-09-12T18:41:42.243 回答