On this page
site.addsitedir
Prev: site.addpackage | Up: site | Next: site.addsitepackages
Rel: site.abs_paths, site.addpackage, site.addsitepackages, site.addusersitepackages
Ref: docs.python.org — site.addsitedir
Tags: #public #python3 #stdlib #site
Import
import site
from site import addsitedir
Signature & Overview
site.addsitedir(sitedir, known_paths=None)
Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'
Usage
from pathlib import Path
import site, tempfile
with tempfile.TemporaryDirectory() as tmp:
site.addsitedir(tmp)
Gotchas
- Processes
.pthfiles, unlikesys.path.append().
REPL Inspect
from site import addsitedir
help(addsitedir)
Linked from
- tuts/python3/stdlib_module/site
- tuts/python3/stdlib_module/site/abs_paths
- tuts/python3/stdlib_module/site/addpackage
- tuts/python3/stdlib_module/site/addsitepackages
- tuts/python3/stdlib_module/site/addusersitepackages
- tuts/python3/stdlib_module/site/check_enableusersite
- tuts/python3/stdlib_module/site/enablerlcompleter
- tuts/python3/stdlib_module/site/execsitecustomize
- tuts/python3/stdlib_module/site/execusercustomize
- tuts/python3/stdlib_module/site/gethistoryfile
- tuts/python3/stdlib_module/site/getsitepackages
- tuts/python3/stdlib_module/site/getuserbase
- tuts/python3/stdlib_module/site/getusersitepackages
- tuts/python3/stdlib_module/site/main
- tuts/python3/stdlib_module/site/makepath
- tuts/python3/stdlib_module/site/register_readline
- tuts/python3/stdlib_module/site/removeduppaths
- tuts/python3/stdlib_module/site/setcopyright
- tuts/python3/stdlib_module/site/sethelper
- tuts/python3/stdlib_module/site/setquit
- tuts/python3/stdlib_module/site/venv
Related notes
- tuts/python3/stdlib_module/site/abs_paths Linked here; links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/addpackage Linked here; links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/addsitepackages Linked here; links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/addusersitepackages Linked here; links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/site/check_enableusersite links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/enablerlcompleter links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/execsitecustomize links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/execusercustomize links to this page; shared tags: #site, #stdlib
- tuts/python3/stdlib_module/site/gethistoryfile links to this page; shared tags: #site, #stdlib