def _activate_env_from_path(env_path):
 prev_sys_path = list(sys.path)
 if (sys.platform == 'win32'):
  site_packages_paths = [os.path.join(env_path, 'Lib', 'site-packages')]
 else:
  lib_path = os.path.join(env_path, 'lib')
  site_packages_paths = [os.path.join(lib_path, lib, 'site-packages') for lib in os.listdir(lib_path)]
 for site_packages_path in site_packages_paths:
  site.addsitedir(site_packages_path)
 sys.real_prefix = sys.prefix
 sys.prefix = env_path
 sys.exec_prefix = env_path
 new_sys_path = []
 for item in list(sys.path):
  if (item not in prev_sys_path):
   new_sys_path.append(item)
   sys.path.remove(item)
 sys.path[:0] = new_sys_path

def _activate_env_from_path ( env_path ) : prev_sys_path = list ( sys . path ) if ( sys . platform == 'win32' ) : site_packages_paths = [ os . path . join ( env_path , 'Lib' , 'site-packages' ) ] else : lib_path = os . path . join ( env_path , 'lib' ) site_packages_paths = [ os . path . join ( lib_path , lib , 'site-packages' ) for lib in os . listdir ( lib_path ) ] for site_packages_path in site_packages_paths : site . addsitedir ( site_packages_path ) sys . real_prefix = sys . prefix sys . prefix = env_path sys . exec_prefix = env_path new_sys_path = [ ] for item in list ( sys . path ) : if ( item not in prev_sys_path ) : new_sys_path . append ( item ) sys . path . remove ( item ) sys . path [ : 0 ] = new_sys_path
fix when activate_this .