A Python 3.x library that integrates Python with SWI Prolog using the 
Machine Query Interface is included within the libs 
directory of the SWI Prolog installation. It is also available using pip install swiplserver. 
See the Python 
swiplserver library documentation for more information on how to use 
and install it from either location.