How to install python2.7 in Ubuntu 16.04

17,659

Solution 1

Try to remove mongodb-compass with

sudo apt-get purge mongodb-compass

Then check that everything is in place with

sudo apt-get install -f
sudo apt-get check

Solution 2

Try this simple command and get python 2.7 installed, thanks

sudo apt install python-minimal

and check the version you will get 2.7.X version (python -V)

Share:
17,659

Related videos on Youtube

Raven
Author by

Raven

By Day: Student By Night: Virtual assistant and C# developer working on web automation.

Updated on September 18, 2022

Comments

  • Raven
    Raven over 1 year

    I'm trying to install Python 2.7 on Ubuntu 16.04. When I trype python or python2 or python2.7, I get the following message:

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

    After running sudo apt install python2.7, I get the following message but python is still unavailable when I type python.

    Reading package lists... Done Building dependency tree Reading state
    information... Done You might want to run 'apt-get -f install' to
    correct these: The following packages have unmet dependencies: 
    mongodb-compass : Depends: gvfs-bin
                      Depends: python but it is not going to be installed     
    python2.7 : Depends: python2.7-minimal (= 2.7.12-1ubuntu0~16.04.3) but 
    it is not going to be installed
                Depends: libpython2.7-stdlib (= 2.7.12-1ubuntu0~16.04.3) but   
    it is not going to be installed
    E: Unmet dependencies. 
    Try 'apt-get -f install' with no packages (or specify a solution).
    

    I also tried:

    • sudo apt install python
    • sudo apt install python2.7
    • sudo apt install python2
    • sudo apt-get install python
    • sudo apt-get install python 2.7
    • sudo apt-get install python2

    Nothing have worked till now.

    I can access Python3.5 by just typing python3, but I need python2.7. I updated the repository before trying to install python. What am I doing wrong?

    Update

    Running cache policy for python:

    python2.7:
      Installed: (none)
      Candidate: 2.7.12-1ubuntu0~16.04.3
      Version table:
         2.7.12-1ubuntu0~16.04.3 500
            500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
         2.7.12-1ubuntu0~16.04.2 500
            500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
         2.7.11-7ubuntu1 500
            500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
    

    Running cache policy for mongodb:

    mongodb-compass:
      Installed: 1.6.0-1
      Candidate: 1.6.0-1
      Version table:
     *** 1.6.0-1 100
            100 /var/lib/dpkg/status
    
    • N0rbert
      N0rbert over 6 years
      Please update your question with output of apt-cache policy python2.7. It seems that you have PPAs or third-party repositories. In Trusty python2.7 is packaged normally.
    • N0rbert
      N0rbert over 6 years
      You tagged question with 14.04 tag, but have Xenial repositories. I do not understand this. What is the output of cat /etc/os-release (add to question)?
    • Raven
      Raven over 6 years
      Sorry about that, I'm using ubuntu 16.04. I edited my question
    • N0rbert
      N0rbert over 6 years
      What is the output of apt-cache policy mongodb-compass?
    • N0rbert
      N0rbert over 6 years
      Try to remove it with sudo apt-get purge mongodb-compass. And retry python installation.
    • user535733
      user535733 over 6 years
      Need to find out why libpython2.7-stdlib won't be installed. Try installing it ans show us the error messages.
  • Raven
    Raven over 6 years
    Does that mean I've to install mongodb-compass again?
  • N0rbert
    N0rbert over 6 years
    You can install mongodb-compass if you need it. I do not know its source.