Getting "fatal error: Python.h: No such file or directory" while installing python packages using pip3.

Solution Verified - Updated -


  • Unable to install python packages through pip3.
  • Getting error while installing psutil through pip3:

    psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
    compilation terminated.


  • Red Hat Enterprise Linux 7
  • python3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content