Created
July 14, 2014 06:12
-
-
Save cournape/3c046e562c35c82c8dd3 to your computer and use it in GitHub Desktop.
venv detection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
if hasattr(sys, "real_prefix"): | |
print("Using virtualenv.") | |
elif hasattr(sys, "base_prefix"): | |
print("Using venv.") | |
else: | |
print("Not in venv/virtualenv.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment