Skip to content

How to fix Error: Command ‘GCC” failed with exit status 1?

  • by
  • 2 min read
Top 7 games for kids to learn coding | Candid.Technology

Programming has become quite simple compared to earlier when lower-level languages like Assembly used to be the norm. That said, random bugs and glitches are still the order of the day when working with scripts or installing packages for most developers. 

In this article, we’re talking about the “Error: Command ‘GCC’ failed with exit status 1” issue when compiling Python packages, its causes and what you can do to fix the problem. 


What causes this error?

The error can be triggered when you install a Python library that requires a C compiler which is missing from your machine. Other possible causes include:

  • Incorrect GCC version.
  • Dependency packages aren’t installed. 

Also read: How to fix Fatal error: Python.h: No such file or directory?


How to fix this?

Here are x fixes you can try out. 

Install GCC

The most straightforward fix for the problem is to install the GCC compiler. Based on your Linux distribution, run the appropriate command given below. 

# Debian
sudo apt-get install gcc

# REHL/Fedora/CentOS
sudo yum install gcc

# Arch/Manjaro
sudo pacman -S gcc

# macOS
brew install gcc

Install Build dependencies

Another missing link when compiling GCC packages is the build-essentials package which includes everything you’d need to install and compile packages locally. 

Based on your Linux distribution, run the appropriate command below.

# Debian
sudo apt-get install build-essentials

# REHL/Fedora/CentOS
sudo dnf group install "Development Tools"

# Arch/Manjaro
sudo pacman -Sy base-devel

Install Python dev packages

Finally, Python dev packages are also a prerequisite if you’re compiling packages locally. 

Based on your Linux distribution, run the appropriate command below.

# Debian
sudo apt-get install python-dev
sudo apt-get install python3-dev

# REHL/Fedora/CentOS
sudo dnf install python-devel
sudo dnf python3-devel

# Arch/Manjaro
sudo pacman -S python3 cmake

Also read: How to fix Error: ‘list’ object cannot be coerced to type ‘double’?

>