python-config command not found

In this troubleshooting guide we learn how to fix python-config command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

python-config: command not found

or when using sudo you get the following error message

sudo: python-config: command not found

Solutions to python-config: command not found

How To Fix python-config: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu python-config is provided by python-dev-is-python3 package.

python-dev-is-python3 is:

Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal) releases, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python-config at all. Some third-party code is now predominantly python3 based, yet may use /usr/bin/python-config.

This is a convenience package which ships a symlink to point /usr/bin/python-config script at the current default python3. It may improve compatibility with other modern systems, whilst breaking some obsolete or 3rd-party software.

No packages may declare dependencies on this package.

To fix this problem, we can install more using the command below.

sudo apt-get -y install python-dev-is-python3

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install python-dev-is-python3.

sudo apt -y install python-dev-is-python3

Or if you have aptitude installed you can use the following command.

sudo aptitude install python-dev-is-python3

Summary

In this tutorial we learn how to fix python-config command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.