问题
In one of my python project I create a config folder in the user directory.
However, when the package is uninstalled via pip, the config folder remains still. There isn't any confidential data so this isn't a security problem but I would like to delete it for user convenience.
My question is, is there any way of doing it properly?
回答1:
Python wheels — and even less eggs or sdists — are not full-blown packages, they don't have post-install or pre-uninstall script. And they probably shouldn't.
Anyway, users expect config files to remain in place after a program is uninstalled — just in case they reinstall the program again. And of course they expect the config will not be overwritten on the second installation.
来源:https://stackoverflow.com/questions/50088440/python-execute-action-at-package-uninstall