3

Having exactly the same problem described on this page: http://qnundrum.com/answer.php?q=431114

Below is directly quoted from that page:

I am unable to install python-dev becasue of unmet dependancies. How can I get around this? Deleting python is not an option and I cant got back to python2.6-dev as it cant be found.

sudo apt-get install python-dev

The following packages have unmet dependencies: python-dev : Depends: python2.7-dev (>= 2.7.3) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

So try python2.7-dev

sudo apt-get install python2.7-dev

The following packages have unmet dependencies:
python2.7-dev :
    Depends: python2.7 (= 2.7.3-0ubuntu3) but 2.7.3-0ubuntu3.1 is to be installed
    Depends: libpython2.7 (= 2.7.3-0ubuntu3) but 2.7.3-0ubuntu3.1 is to be installed
E: Unable to correct problems, you have held broken packages.

So my question is how I can solve this problem without uninstall Python? Any advice would be really appreciated!

mgorven
  • 30,036
  • 7
  • 76
  • 121
  • 1
    Your installed `python2.7` and `libpython2.7` packages may be out of date, run `apt-get update; apt-get dist-upgrade` first. – mgorven Mar 08 '13 at 22:46
  • I found very easy solution. Check this link: https://askubuntu.com/a/922325/498798 – Scott Feb 06 '18 at 09:07

3 Answers3

2

If you're not already, try changing your package repository reference to 'Main' or the United States. Doing this fixed my Python-dev unmet-dependencies problem (my 12.04 install was using the United Kingdom package repository, previously).

  1. In 'Ubuntu Software Center' (USC) go to the menu/tab 'Edit => Software Sources'.
  2. Change the 'Download from' drop-down value to 'Main Server' or a server in the United States.
  3. Leave USC, the open 'Update Manager' from Ubuntu's program menu, and 'Check' for software update (or issue 'sudo apt-get update' in a terminal window).
  4. Update your software as you normally would, e.g. via 'Update Manager' or apt-get/aptitude in a terminal.

This repaired my repository and I went on to install whatever I needed afterwards, as normal.

Before rectifying my problem with the above instructions, various aptitude/apt-get commands suggested that I remove many, many packages, but, as you can apreciate, I didn't fancy loosing my 6-months+ of package additions, and that's even though I snapshot the package list at times (see my gist for hints)! I'm really glad I found out about the instructions I'm leaving here.

Hope this helps.

Big Rich
  • 121
  • 4
1

In the end, I used Aptitude, which downgrades my Python version.

0

Adding

deb http://us.archive.ubuntu.com/ubuntu/ precise-security main

deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main

to sources.list solved it for me

folex
  • 101
  • 1