Issue
As Python 3.7 was being prepared I installed Python 3.7.0b3
from source. Now 3.7 is out and I want to use the version packaged for Ubuntu. So I've done
apt-get install python3.7
but
$ which python3.7
/usr/local/bin/python3.7
$ /usr/local/bin/python3.7 --version
Python 3.7.0b3
How does one uninstall a Python installed from source (on Ubuntu)? Or how can I replace it with the apt repo packaged version?
Solution
Since you opened a bounty, I can't vote to close as a duplicate, but this question would seem to provide a possible solution. Quoting from the accepted answer:
You can use checkinstall to remove Python. The idea is:
- Install checkinstall
- Use checkinstall to make a deb of your Python installation
- Use
dpkg -r
to remove the deb.
checkinstall
basically wraps a make install
command and creates a Debian .deb
package based on what was installed. Then, you can just uninstall that package to reverse make install
completely. To be perfectly safe you may want to uninstall the packaged Python 3.7 first and reinstall it afterwards to avoid any conflicts (I wouldn't expect any, though, since the packaged version lives in /usr while your source version lives in /usr/local).
If you don't have your source files around anymore, you can always download them again (https://www.python.org/downloads/release/python-370b3/) and rebuild Python. Specifically, the checkinstall
commands would look something like this:
sudo apt install checkinstall
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0b3.tgz
tar xf Python-3.7.0b3.tgz
cd Python-3.7.0b3
./configure && make
sudo checkinstall -D --fstrans=no make install
sudo dpkg -r Python-3.7.0b3.deb
(-D
creates a Debian package, --fstrans=no
disables use of a temporary directory for installation).
Answered By - nneonneo Answer Checked By - Willingham (WPSolving Volunteer)