Solution for the error “Python headers are required to build Mercurial but weren’t found”

I once installed Mercurial and noticed the following error:

ERROR:
Python headers are required to build Mercurial but weren’t found in /usr/include/python2.7/Python.h

To solve this error, install python-dev, for example in Ubuntu it can be done like this:

sudo apt-get update
sudo apt install python-dev python-docutils gcc

In CentOS, like this:

sudo yum install python-devel gcc
Did my article help you? How about buying me a cup of coffee as an encouragement? Buy me a coffe.

Leave a comment

Leave a Reply