code: def _virtualenv_sys(venv_path):
      "obtain version and path info from a virtualenv."
      executable = os.path.join(venv_path, env_bin_dir, 'python')
      # Must use "executable" as the first argument rather than as the
      # keyword argument "executable" to get correct value from sys.path
      p = subprocess.Popen([executable,
          '-c', 'import sys;'
                'print (sys.version[:3]);'
                'print ("\\n".join(sys.path));'],
          env={},
          stdout=subprocess.PIPE)
      stdout, err = p.communicate()
      assert not p.returncode and stdout
      lines = stdout.decode('utf-8').splitlines()
      return lines[0], list(filter(bool, lines[1:])f _virtualenv_sys(venv_path):
      "obtain version and path info from a virtualenv."
      executable = os.path.join(venv_path, env_bin_dir, 'python')
      # Must use "executable" as the first argument rather than as the
      # keyword argument "executable" to get correct value from sys.path
      p = subprocess.Popen([executable,
          '-c', 'import sys;'
                'print (sys.version[:3]);'
                'print ("\\n".join(sys.path));'],
          env={},
          stdout=subprocess.PIPE)
      stdout, err = p.communicate()
      assert not p.returncode and stdout
      lines = stdout.decode('utf-8').splitlines()
      return lines[0], list(filter(bool, lines[1:]))
docs: obtain version and path info from a virtualenv.