I tried these commands:
pip install libjpeg8-dev
pip install libjpeg-dev
pip install libjpeg-devel
pip install libjpeg
pip install libjpeg62 libjpeg62-dev
but none of them works. What is the right command with pip?
libjpeg
is not a python module and pip won't ever be able to install it.
Use your Operating System's packaging system to install it. On Ubuntu and Debian that'd be apt, for example.