That's one hilarious slip of the fingers; I always like to use
sudo echo /path/to/files/*glob* to see what files specifically I'm about to delete before I change the
rm. Now you've learned the lesson too! Fun.
Preaching aside, this shouldn't be too hard to fix, but it will take a few "passes".
deb packages are
ar(1) packages, and can be easily manipulated with
$ ar xv /var/cache/apt/archives/python-papyon_0.5.5-1ubuntu1.3_all.deb
x - debian-binary
x - control.tar.gz
x - data.tar.gz
ar xv /var/cache/apt/archives/<package_for_overwriting>
tar zxvf /tmp/fixing_python/data.tar.gz
Iterate that for every package you need to "fix".
-c command line option might be helpful, if you've got
Note that the
tar command there is a bit "destructive" -- it'll overwrite whatever it needs to. If you'd rather see what everything will unpack, skip the
cd / step beforehand, and
tar(1) will unpack into the directory instead, giving you a chance to see what is done.
Once you've got everything unpacked that you need, I'd try hard to get
dpkg(1) "happy" again through its own mechanisms. (The
control.tar.gz contains control scripts that are executed on upgrades, installs, uninstalls, etc. I just had you skip all of them, thinking that once you've got Python re-installed, you can use
dkpg(1) itself to fix the problems.)
We surely have different packages installed, but this might be helpful for you in finding out which packages need fixing:
$ dpkg -S /usr/bin/python*
And note that you can pull down packages directly from the archives without using
apt-get(8). They're just HTTP sites and http://packages.debian.org or http://packages.ubuntu.com will make it easy to grab the packages you need with
Oh yes, note that
/usr/lib/python* is where the Python libraries and modules are kept.
/usr/bin/python* is where the Python interpreter is kept. Your attempt to fix things with
cp /usr/lib/python2.7 /usr/bin/python2.7 didn't help. Also
/usr/lib/python2.7 is a directory, but
/usr/bin/python should be (and was) a single executable file. Feel free to
rm -r /usr/bin/python2.7 /usr/bin/python.