No acceptable C compiler found in PATH when installing Python
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
This error appears when you are building Python from source and the build system cannot find a working C compiler. The fix is usually straightforward: install a compiler toolchain, make sure it is on PATH, and rerun the configure step.
Why Python Needs a C Compiler
CPython is implemented in C, so a source build needs a C compiler to produce the interpreter binary. Even though many users think of Python as a scripting language, building the interpreter itself is a native compilation task.
If you are not actually trying to build from source, pause first. On many systems, using the official installer or a package manager is easier than compiling CPython manually.
Confirm the Problem
Before installing anything, check whether the shell can see a compiler.
If all of those commands fail, the build system’s complaint is accurate. If one works in your interactive shell but configure still cannot find it, the issue is usually a different PATH in the current environment or shell session.
Install a Compiler on Linux
On Debian and Ubuntu systems, the usual fix is to install the build toolchain package.
On Fedora, RHEL, and similar systems, install the compiler tools group or the relevant packages.
After installation, rerun cc --version or gcc --version to confirm the compiler is visible.
Install a Compiler on macOS
On macOS, the most common solution is the Xcode Command Line Tools package.
macOS usually provides clang rather than gcc, and that is fine for building CPython.
Build Python Again
Once the compiler is available, rerun the source-build steps.
On macOS, replace nproc with a suitable value if needed, or just run make without a parallelism flag.
If configure still fails, inspect config.log. That file usually shows the exact compile test that broke and can reveal a missing compiler, a broken PATH, or a permissions issue.
Check the Environment Used by the Build
The compiler may exist on the machine but not in the environment used to run the build. This happens in CI jobs, non-login shells, or scripts that overwrite PATH.
Setting CC explicitly can help when the system has multiple compilers or when the default cc lookup is not the one you want.
The Compiler Is Only the First Dependency
A working compiler gets you past this error, but a full Python build may still need development headers and libraries for optional modules such as compression, SSL, or database support. If the interpreter builds but some extension modules are skipped, that is a separate dependency issue rather than the same compiler error.
Common Pitfalls
- Trying to solve this with
pip installcommands does not help because the missing piece is a system compiler. - Assuming
gccis required specifically is too narrow. A working C compiler such asclangis usually enough. - Forgetting to open a new shell after installing tools can leave
PATHunchanged. - Building from source when a package manager install would do is often unnecessary work.
- Ignoring
config.logmakes compiler-detection failures harder to diagnose.
Summary
- This error means the Python source build cannot find a usable C compiler.
- Check
cc,gcc, andclangbefore doing anything else. - Install the platform toolchain such as
build-essentialor Xcode Command Line Tools. - Rerun
configureafter the compiler is available, and inspectconfig.logif it still fails. - Remember that a compiler solves this specific error, but optional Python modules may need additional system libraries.

