如何让 pip 知道删除 systemd 服务文件

How do I let pip to know to remove the systemd service file

在我的 python 包中,我向用户提供 运行 作为服务,然后安装一个 .service 文件。

如果软件包被卸载,有没有办法让 pip 知道删除它?

谢谢

pip 不是一个完整的包管理器,更不是系统包管理器。它不支持 post 安装或预卸载脚本。

您的问题的 2 个解决方案是:

  1. 将上述 service 文件包含在您的 wheel 中,以便 pip uninstall 将其删除;

  2. 根本不要使用 pip,将您的包转换为 rpm or deb