Note that the first entry in PYTHONPATH is '', meaning that the Python interpreter will first look in the current directory when trying to do an import. # looking up `PYTHONPATH` > import sys > sys. The official Python tutorial provides a nice overview of this material and dives into details that we will not concern ourselves with here. A brief overview will be provided of the two most popular venues for hosting Python packages to the world at large: the Python Package Index (PyPI) and. To conclude this section, we will demonstrate the process of installing a Python package on your system supposing that you have written your own Python package, installing it enables you to import it anywhere on your system.
The standard library and other collections of Python code, but it will permit us to create our own packages of code. Detailing this packaging system will not only provide us with insight into the organization of py files from which we can import functions and objects, and packages are collections of such modules.
#JUPYTER NOTEBOOK ONLINE IMPORT MODULE CODE#
Here, we will finally pay our due diligence and discuss Python’s import system, which entails understanding the way that code can be organized into modules and packages. # accessing `defaultdict` from the standard library's `collections` package from collections import defaultdict # import the entire numpy package, giving it the alias 'np' import numpy as npĭespite our regular use of the import statement, we have thus far swept its details under the rug.