code: def _build_from_requirements(cls, req_spec):
          
          # try it without defaults already on sys.path
          # by starting with an empty path
          ws = cls([])
          reqs = parse_requirements(req_spec)
          dists = ws.resolve(reqs, Environment())
          for dist in dists:
              ws.add(dist)
  
          # add any missing entries from sys.path
          for entry in sys.path:
              if entry not in ws.entries:
                  ws.add_entry(entry)
  
          # then copy back to sys.path
          sys.path[:] = ws.entries
          return ws
docs: Build a working set from a requirement spec. Rewrites sys.path.