简体   繁体   中英

Remove Old Version of Python Package on Install

I'm creating a Django package that contains some core functionality I will use across multiple web apps.

Now, this is the first time I'm creating a Django/Python package. I have read up on existing documentation and tutorials.

My problem is that, every time I make a change to the package and recreate the package, and reinstall it using the "python setup.py install" method, the new package is in fact installed, but the previous version remains.

So, for example, right now I have the latest 3 versions of the package installed in my machine.

How do I make it so an installation of the package removes all previous installations of the same package?

Thank you

It seems that this is a known problem.

The reporter of Issue 5342 has the same issue with old files persisting in the install directory.

Per Issue 4673 , distutils2 now has an uninstall command that you could use to clean your directory on an install. Perhaps you could override the install command such that it first tries to uninstall an old package first?


Otherwise, it seems the solution is:

to hack some old file detection into each package, or tell users 'delete the old install first'. Neither of which is really nice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM