Ubuntu – python command on terminal not working

16.04command linepython

Same question found here but without a valid solution. The problem is that typing python in the terminal produces:

The program 'python' can be found in the following packages:
 * python-minimal
 * python3
Try: sudo apt install <selected package>

In fact, $ which python returns nothing. Additional information:

~$ echo $PATH
/usr/local/cuda-8.0/bin:/home/fontana/bin:/home/fontana/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

By default python should point to python2.7 in /user/bin. If I type python2.7, python runs normally. How to restore the default behavior when typing python in the terminal?

EDIT: Potential source of the problem: I've recently installed python 3.4.6 (in /user/local/bin) using the following commands. Than I tried to reinstall python 3.4.6 since there was a problem with pip now fixed.

./configure
make
make test
sudo make install

Best Answer

I fixed the problem with

sudo apt install python-minimal

as suggested in the warning message. I have decided to install python-minimal rather than python3 since the latter was already working smoothly in the terminal.