Python library
A python library can be source code (to be interpreted) or precompiled. To call a library, it is used the
import XXX
keyword. The python
utility will look in several location for several files.
- A file named
XXX.py
orXXX/__init__.py
in the directory wherepython
is run. - A file named
XXX.py
orXXX/__init__.py
in thePYTHONPATH
environment variable, if it is set. - A file named
XXX.py
orXXX/__init__.py
in an installation-dependent list of directories configured at the time Python is installed
The last one is where external library are stored usually, to check where the file actually is use the sys
python module:
python
>>> import dolfinx
>>> dolfinx.__file__
'/home/mattia/miniconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/__init__.py'