core/homeassistant/util/environment.py

10 lines
267 B
Python
Raw Normal View History

""" Environement helpers. """
import sys
def is_virtual():
""" Return if we run in a virtual environtment. """
2015-07-11 07:02:42 +00:00
# Check supports venv && virtualenv
return (getattr(sys, 'base_prefix', sys.prefix) != sys.prefix or
hasattr(sys, 'real_prefix'))