MCPcopy Index your code
hub / github.com/python/cpython / getusersitepackages

Function getusersitepackages

Lib/site.py:350–365  ·  view source on GitHub ↗

Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it.

()

Source from the content-addressed store, hash-verified

348
349
350def getusersitepackages():
351 """Returns the user-specific site-packages directory path.
352
353 If the global variable ``USER_SITE`` is not initialized yet, this
354 function will also set it.
355 """
356 global USER_SITE, ENABLE_USER_SITE
357 userbase = getuserbase() # this will also set USER_BASE
358
359 if USER_SITE is None:
360 if userbase is None:
361 ENABLE_USER_SITE = False # disable user site and return None
362 else:
363 USER_SITE = _get_path(userbase)
364
365 return USER_SITE
366
367def addusersitepackages(known_paths):
368 """Add a per user site-package to sys.path

Callers 2

addusersitepackagesFunction · 0.85
_scriptFunction · 0.85

Calls 2

getuserbaseFunction · 0.85
_get_pathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…