On this page
site.addpackage
Prev: site.abs_paths | Up: site | Next: site.addsitedir
Rel: site.abs_paths, site.addsitedir, site.addsitepackages, site.addusersitepackages
Ref: docs.python.org — site.addpackage
Tags: #public #python3 #stdlib #site
Import
import site
from site import addpackage
Signature & Overview
site.addpackage(sitedir, name, known_paths)
Process a .pth file within the site-packages directory: For each line in the file, either combine it with sitedir to a path and add that to known_paths, or execute it if it starts with 'import '.
Usage
import site
# Processes a single .pth file inside sitedir
assert callable(site.addpackage)
Gotchas
- Executes lines starting with
importinside.pthfiles: Only run on trusted directories.
REPL Inspect
from site import addpackage
help(addpackage)
Linked from
- tuts/python3/stdlib_module/site
- tuts/python3/stdlib_module/site/abs_paths
- tuts/python3/stdlib_module/site/addsitedir
- 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/addsitedir 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