import os

def add_virtual_env_segment():
    env = os.getenv('VIRTUAL_ENV')
    if env is None:
        return

    env_name = os.path.basename(env)
    bg = Color.VIRTUAL_ENV_BG
    fg = Color.VIRTUAL_ENV_FG
    powerline.append(' %s ' % env_name, fg, bg)

add_virtual_env_segment()

import os

def add_virtual_env_segment():
    env = os.getenv('VIRTUAL_ENV') or os.getenv('CONDA_ENV_PATH')
    if env is None:
        return

    env_name = os.path.basename(env)
    bg = Color.VIRTUAL_ENV_BG
    fg = Color.VIRTUAL_ENV_FG
    powerline.append(' %s ' % env_name, fg, bg)

add_virtual_env_segment()

Allow venv segment to be from Anaconda
Allow venv segment to be from Anaconda

  import os
  
  def add_virtual_env_segment():
-     env = os.getenv('VIRTUAL_ENV')
+     env = os.getenv('VIRTUAL_ENV') or os.getenv('CONDA_ENV_PATH')
      if env is None:
          return
  
      env_name = os.path.basename(env)
      bg = Color.VIRTUAL_ENV_BG
      fg = Color.VIRTUAL_ENV_FG
      powerline.append(' %s ' % env_name, fg, bg)
  
  add_virtual_env_segment()
  
Allow venv segment to be from Anaconda
## Code Before:
import os

def add_virtual_env_segment():
    env = os.getenv('VIRTUAL_ENV')
    if env is None:
        return

    env_name = os.path.basename(env)
    bg = Color.VIRTUAL_ENV_BG
    fg = Color.VIRTUAL_ENV_FG
    powerline.append(' %s ' % env_name, fg, bg)

add_virtual_env_segment()

## Instruction:
Allow venv segment to be from Anaconda
## Code After:
import os

def add_virtual_env_segment():
    env = os.getenv('VIRTUAL_ENV') or os.getenv('CONDA_ENV_PATH')
    if env is None:
        return

    env_name = os.path.basename(env)
    bg = Color.VIRTUAL_ENV_BG
    fg = Color.VIRTUAL_ENV_FG
    powerline.append(' %s ' % env_name, fg, bg)

add_virtual_env_segment()
