This will use python2 even though it's deprecated since MotionEye still does not work with python3
sudo apt install motion ffmpeg v4l-utils python libcurl4-openssl-dev libssl-dev \
python-pip \
virtualenv \
python-libtiff \
libtiff-dev \
libjpeg-dev \
libz-dev
mkdir /opt/motioneye
cd /opt/motioneye
python3 -m venv venv
. venv/bin/activate
pip install motioneye
cp venv/share/motioneye/extra/motioneye.conf.sample .
mv motioneye.conf.sample motioneye.conf
sed -i 's/\/etc\/motioneye/\/opt\/motioneye/g' motioneye.conf
sudo meyectl startserver -c /opt/motioneye/motioneye.conf