Cannot use CSI camera in virtualenv jetson nano

I want to test my CSI camera with a python script. So, I clone this Github repo. And run
when I run locally it works fine, but when I run it inside the virtualenv it said “Unable to open camera”

Hi @thanachot.spk

Have you tried to use gstreamer for testing CSI camera?

gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! ‘video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12’ ! nvvidconv flip-method=0 ! ‘video/x-raw,width=960, height=616’ ! nvvidconv ! nvegltransform ! nveglglessink -e

Not familiar with virtualenv not sure the environment configure from below link can help or not.