Python apt install can install prerequisites using apt install. However, this is quite risky. We strongly recommend instead using install_requires of setup.cfg.


This process is not normally recommended, as most popular Python packages that require compiling have .whl binary wheel.

An example

from setuptools import setup
import subprocess

install_requires = ['numpy','scipy']

req = [f'python3-{r}' for r in install_requires]

cmd = ['sudo','apt-get','install'] + req
print(' '.join(cmd))