check active virtualenv code example
Example: how to know if i'm in a virtual environment
import sys
sys.prefix == sys.base_prefix
# if true, you are not in a virtual env
import sys
sys.prefix == sys.base_prefix
# if true, you are not in a virtual env