Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install python3-dev in Ubuntu 20.04?

I am trying to install python3-dev in Ubuntu 20.04, got the following error:

$ sudo apt-get install python3-dev

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

This suggest that I need to install python3.8-dev first, so I tried to install that package and it failed with the following error:

$ sudo apt-get install python3.8-dev

The following packages have unmet dependencies:
 python3.8-dev : Depends: zlib1g-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Again, I tried to install the package: zlib1g-dev and it also failed:

$ sudo apt-get install zlib1g-dev

The following packages have unmet dependencies:
 zlib1g-dev : Depends: zlib1g (= 1:1.2.11.dfsg-2ubuntu1) but 1:1.2.11.dfsg-2ubuntu1.2 is to be installed
E: Unable to correct problems, you have held broken packages.

Finally, the package zlib1g is already installed but it seems that zlib1g-dev needs a different version of zlib1g. However, it seems that ubuntu 20.04 doesn't have it:

$ sudo apt-get install zlib1g=1.2.11.dfsg-2ubuntu1

Reading state information... Done
E: Version '1.2.11.dfsg-2ubuntu1' for 'zlib1g' was not found

What can I do at this point?

like image 296
Wei Li Avatar asked Feb 13 '26 18:02

Wei Li


1 Answers

before to install this, you have to be root

sudo -i

then

sudo apt-get install python3-dev
like image 194
stevejobs Avatar answered Feb 16 '26 07:02

stevejobs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!