web123456

Python error: error: command ‘/usr/bin/gcc’ failed with exit code 1

Preface

Usually, when we use pip to install some Python dependency packages on Linux servers, we occasionally encounter errors as shown below:

...
#include ""
           ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
...

Common cases such as installing uWSGI and mysqlclient will cause similar errors. So what should I do if I encounter this situation?

Solution

foryum(CentOS, RHEL…)

yum install python39-devel

39 python version installed for you

forapt(Ubuntu, Debian…)

sudo apt-get install python-dev   # for  installs
sudo apt-get install python3-dev  # for  installs

Reference link

fatal error: : No such file or directory