Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在创建一个带有 gzip 文件的 pip 包,并在第一次导入模块时解压缩它们。我意识到这是不寻常的,并不是一个好主意,但考虑到我的限制,它似乎是传送数据的最佳方式。
我注意到的一个问题是,如果您通过 pip 卸载软件包,则提取的文件不会被删除,并且 pip 会显示以下消息:
Would not remove (might be manually added): file1 file2
有没有什么地方setup.py我可以指定这些文件属于我的包并且在卸载时应该删除?
setup.py
如果您创建与要创建的文件同名的空文件并将它们添加到包中,那么 pip 会将它们识别为包的一部分并在卸载包时将其删除。所以没有setup.py指定路径的机制或任何机制,但使用虚拟文件是可行的。