Problem scenario
You are using Python 2.7.12 on Ubuntu 16. You want to upgrade to Python 3.x You are having problems. You tried several things as follows:sudo apt-get -y install python 3.7
But you see this:
python is already the newest version (2.7.12-1~16.04).
python set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libgnuradio-fosphor3.7.0 : Depends: ocl-icd-libopencl1 (>= 1.0) but it is not going to be installed or
libopencl-1.1-1
E: Unable to correct problems, you have held broken packages.
sudo apt -y install libopencl-1.1-1
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting 'ocl-icd-libopencl1' instead of 'libopencl-1.1-1'
ocl-icd-libopencl1 is already the newest version (2.2.8-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo apt -y install ocl-icd-libopencl1
Reading package lists… Done
Building dependency tree
Reading state information… Done
ocl-icd-libopencl1 is already the newest version (2.2.8-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo apt -y install libgnuradio-fosphor3.7.0
Reading package lists… Done
Building dependency tree
Reading state information… Done
libgnuradio-fosphor3.7.0 is already the newest version (3.7.0.1.e1eb11b-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
You tried rebooting, updating and upgrading packages. Nothing seems to work. How do you upgrade to Python 3.x?
Solution
1. Try this command: whereis python3
You will likely find the binary in /usr/bin/.
2. Make a back up of the binary for python 2 (e.g., /usr/bin/python). You may want to do it like this: sudo mv /usr/bin/python /usr/bin/bakpythonbak
3. Move the file you found in step #1 to be where the file is that you backed up in step #2. You may want to do it like this: sudo mv /usr/bin/python3 /usr/bin/python
4. You are done. If you are still having problems, you may want to look at your /etc/apt/sources.list file. You may want to back it up before making changes too.