Unable to install python on Ubuntu

0

I need to install python version 2 (2.7) to use Nvidia Jetson TX2. It doesn't seem to install. Does anyone know the issue? Thanks in advance.

I ran this command

python -version

And got this output

Command 'python' not found, but can be installed with:
sudo apt install python3       
sudo apt install python        
sudo apt install python-minimal

You also have python3 installed, you can run 'python3' instead.

I then run this command

sudo apt install python

And then get this message

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
 python : PreDepends: python-minimal (= 2.7.15~rc1-1) but it is not going to be installed
          Depends: python2.7 (>= 2.7.15~rc1-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Rish

Posted 2019-06-04T13:57:45.517

Reputation: 3

The answer here seemed to do the trick.

– Rish – 2019-06-04T20:54:36.540

Although, be sure to read the warning at the bottom of that answer. – Rish – 2019-06-10T20:31:25.980

Answers

0

Although I have cursory experience with Ubuntu, from what I can understand from the error, you may need to reinstall the original packages as they may have not been installed correctly to begin with. Inputting the following commands may help fix the problem by reinstalling the dependencies it asks for:

sudo apt install python-minimum
sudo apt install python2.7

Also, as it says python3 is installed (not python), the first command you put in to find the version should be:

python3 --version

Ciaran

Posted 2019-06-04T13:57:45.517

Reputation: 1

0

When you say to Ubuntu "install python", because Python 2.x and Python 3.x coexist now, "python" can be Python 2.x or 3.x. You need to explicitly designate Python 2 or 3.

Python 2 and 3 have a few incompatible differences. Error you are seeing a result of Ubuntu's apt tree is set up to not install python unless you tell it to install 2.x or 3.x Your problem should go away by "sudo apt install python2.7" or python2.7-minimal.

EDIT: BTW, if you install Ubuntu 18.04LTS Mate, python2 and python3 are both installed by default. Updating your Ubuntu to 18.04 may solve your problem as well.

Naoyuki Tai

Posted 2019-06-04T13:57:45.517

Reputation: 139