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.pyorXXX/__init__.pyin the directory wherepythonis run. - A file named
XXX.pyorXXX/__init__.pyin thePYTHONPATHenvironment variable, if it is set. - A file named
XXX.pyorXXX/__init__.pyin 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'