2

This morning I installed python3.3.2 from source, which is giving me some headaches, so now I want it removed. python3 launches python3.3.2, which is stored in /usr/local/bin. However, when I try to remove it, it wants to remove python3.3.1, stored in /usr/bin. I obviously want to keep this one.

$ which -a python3
/usr/local/bin/python3
/usr/bin/python3

How do I get 'sudo apt-install remove python3' to not remove the necessary 3.3.1 /usr/bin one, and only 3.3.2 one in /local/bin? Thanks for any advice!

awesoon
  • 32,469
  • 11
  • 74
  • 99
Mach
  • 73
  • 2
  • 3
  • 9
  • possible duplicate of [Uninstall python built from source?](http://stackoverflow.com/questions/3544378/uninstall-python-built-from-source) – msw Jun 01 '13 at 10:56

2 Answers2

3

If you installed it from source, apt-install has no idea that it exists.

The easiest way (as most makefiles don't have an uninstall target) is to run make install again in your 3.3.2 source directory and capture what it sticks where and then remove them.

The cheaper way would be to rm /usr/local/bin/python3 and probably anything else in /usr/local/bin/py* including symlinks to various parts of the suite.

msw
  • 42,753
  • 9
  • 87
  • 112
  • I just did so, and now python3 doesn't start. $ which -a python3 /usr/bin/python3 but when I type python3, it still looks for /usr/home/bin/. – Mach Jun 01 '13 at 10:50
  • `sudo apt-get install --reinstall python3` should clean that up. – msw Jun 01 '13 at 10:51
  • or `bash$ hash -r` if your shell has remembered removed versions – msw Jun 01 '13 at 10:53
  • Sadly not, I just reinstalled it and it gave the following response 'bash: /usr/local/bin/python3: No such file or directory' – Mach Jun 01 '13 at 10:53
  • Ah, the second one worked fine. I haven't seen that before, as you have probably guessed, I'm very new to linux, need to learn a lot about the terminal. Thanks! – Mach Jun 01 '13 at 10:56
  • Glad it worked. Incidentally the bash path cache managed by `hash` would have gone away if you had re-logged in. There's almost never a reason to use `hash` which is why many don't know of it. – msw Jun 01 '13 at 10:59
1

The difference is that you compiled python3.3.2 from source so it's not registered with aptitude.

If you go to the directory where you ran ./configure && make && make install simply run:

make uninstall

If this fails (or the python developers have not built for make uninstall), you can do the following:

  1. Install checkinstall
  2. Use checkinstall to make a deb of your Python installation
  3. Use dpkg -r to remove the deb.

That answer was taken from this question Uninstall python built from source.

Community
  • 1
  • 1
Ewan
  • 14,592
  • 6
  • 48
  • 62
  • make uninstall didn't seem to work, but removing the directory worked anyway, it only contained the python installation. A bit of a hack, but it got the job done. Thanks anyway! – Mach Jun 01 '13 at 11:08