On this page
  1. site.addpackage
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

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

REPL Inspect

from site import addpackage
help(addpackage)

Linked from

Related notes