title: Python setup.py install - remove previous version while updating
body: <p>I have a <code>setup.py</code> script for my package which I install using 
  <code>python ./setup.py install</code></p>
  
  <p>What seems to happen is every time I increase the version, the old version is <em>not</em> removed in <code>/usr/local/lib/python2.7/dist-packages</code> so I see multiple versions.</p>
  
  <p>Is there a way to set this up in a way that when a person updates, the old version gets removed?</p>
  
  <p>There is a similar (but not quite) <a href="https://stackoverflow.com/questions/1550226/python-setup-py-uninstall">question</a> on SO that asks how to uninstall a package in setup.py but I'm not really looking to uninstall as a separate option. I am looking for a clean 'update' process that removes old versions before installing new ones.</p>
  
  <p>The other option is if I could just cleanly remove the version number from the installed package name, in which case I suppose it would overwrite, but I haven't been successful in doing that. If I remove version, it creates the package name with "0.0" which looks weird. </p>
  
  <p>My setup script:</p>
  
  <pre><code>import io
  import os
  import sys
  
  from setuptools import setup
  
  #Package meta-data.
  NAME = 'my_package'
  DESCRIPTION = 'My description'
  URL = 'https://github.com/myurl'
  EMAIL = 'myemail@gmail.com'
  AUTHOR = 'Me'
  VERSION = '3.1.12'
  
  setup(name = NAME,
        version=VERSION,
        py_modules = ['dir.mod1',
                      'dir.mod2',
                    ]
        )
  </code></pre>