Solve: Ubuntu16.04 installation of python corresponding version of the pip and dependencies error

Execute: sudo apt-get install python-pip python-dev

Given as follows:

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

 

Workaround: Use the aptitude tool

sudo apt-get install aptitude 

Then: sudo aptitude install python-dev

The following NEW packages will be installed:
  libpython-dev{a} libpython2.7-dev{ab} python-dev python2.7-dev{ab}

。。。 

4)     python2.7-dev [Not Installed]                      

Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Downgrade the following packages:                                          
1)     libpython2.7 [2.7.12-1ubuntu0~16.04.2 (now) -> 2.7.11-7ubuntu1 (xenial)] 
2)     libpython2.7-minimal [2.7.12-1ubuntu0~16.04.2 (now) -> 2.7.11-7ubuntu1 (x
3)     libpython2.7-stdlib [2.7.12-1ubuntu0~16.04.2 (now) -> 2.7.11-7ubuntu1 (xe
4)     python2.7 [2.7.12-1ubuntu0~16.04.2 (now) -> 2.7.11-7ubuntu1 (xenial)]    
5)     python2.7-minimal [2.7.12-1ubuntu0~16.04.2 (now) -> 2.7.11-7ubuntu1 (xeni

Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libpython2.7 libpython2.7-minimal libpython2.7-stdlib python2.7 
。。。
Do you want to continue? [Y/n/?] y
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/precise-updates.list:1 and /etc/apt/sources.list.d/precise-updates.list:2
。。。
Setting up python2.7-dev (2.7.11-7ubuntu1) ...
Setting up python-dev (2.7.11-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

 

Get, you can do sudo apt-get install python-pip python-dev a

 

Published 25 original articles · won praise 28 · views 60000 +

Guess you like

Origin blog.csdn.net/maitianpt/article/details/88363945