Hi there,
When you invoke sudo it runs the command in a new shell session as root, without carrying over the environment settings from your previous session. The way I’d recommend to do it in a command line environment is to:
sudo -i
source /etc/profile.d/pynq_venv.sh
python3 runit.py
That way you login as the root user and setup the pynq_venv with associated env variables. This should be equivalent to opening a terminal on a pynq image with jupyterlab.
Thanks
Shawn