How to build C/C++/Cython/Fortran extensions and frameworks like Caffe, OpenCV, protobuf-dependent projects from source.
pip install setuptools wheel cython 2>/dev/null
apt-get install -y build-essential python3-dev 2>/dev/null
cython file.pyx # Cythonize to .c first
python setup.py build_ext --inplace 2>&1
# Manual fallback:
gcc -shared -fPIC -O2 $(python3-config --includes) -o mod$(python3-config --extension-suffix) mod.c
protoc --version and dpkg -l | grep protobufmake -j$(nproc) but capture errors: make 2>&1 | tee build.logCPU_ONLY := 1 in Makefile.config for non-GPU environmentsmake all -j$(nproc) && make test && make runtestpip install numpy scipypython setup.py build_ext --inplacepip install --no-deps -e .pip install numpy before building numpy-dependent C extensions/tmp, not the source directoryfind . -name "*.so" -newer setup.py
cd /tmp && python -c "import mypackage; print('OK')"