Did you know ... | Search Documentation: |
Janus as a Python package |
The Janus
GIT repo provides setup.py
. Janus may be installed as a
Python package after downloading using
pip install .
pip allows for installation from the git repository in a one-liner as below.
pip install git+https://github.com/SWI-Prolog/packages-swipy.git#egg=janus_swi
Installing janus as a Python package requires
setup.py
runs swipl --dump-runtime-variables
to obtain the installation locations of the various Prolog components.
On Windows, if swipl is not on %PATH%
, setup.py
tries the registry to find the default binary installation.After successful installation we should be able to use Prolog directly from Python. For example:
python >>> from janus_swi import * >>> query_once("writeln('Hello world!')") Hello world! {'truth': True} >>> [a["D"] for a in query("between(1,6,D)")] [1, 2, 3, 4, 5, 6] >>> prolog() ?- version. Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.12-8-g70b70a968-DIRTY) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. ... ?-