Created
January 29, 2015 18:19
-
-
Save lebedov/339d27eb4bab0f87f649 to your computer and use it in GitHub Desktop.
Show virtualenv or conda environment in IPython prompt
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
# Put this in your IPython profile configuration, e.g., ~/.ipython/profile_default/ipython_config.py | |
import os | |
extra = '' | |
if os.environ.has_key('VIRTUAL_ENV'): | |
v = os.path.basename(os.environ['VIRTUAL_ENV']) | |
extra += '<%s> ' % v | |
if os.environ.has_key('CONDA_DEFAULT_ENV'): | |
extra += '[%s] ' % os.environ['CONDA_DEFAULT_ENV'] | |
c.PromptManager.in_template = '%sIn [\#]: ' % extra | |
c.PromptManager.out_template = '%sOut[\#]: ' % extra | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment