Requirements:
PySwip has no dependencies beyond Python's standard library.
Some operating systems do not install the full standard library.
In that case make sure that your Python setup includes the ctypes
module.
We recommend installing PySwip into a virtual environment.
Python3 already has built-in support for that.
You can create a virtual environment in pyswip_env
directory using:
python3 -m venv pyswip_env
After that, you have to activate the virtual environment. On UNIX-like platorms (Linux, MacOS, FreeBSD, etc.) with BASH/csh/tcsh shell:
source pyswip_env/bin/activate
On Windows:
pyswip_env\Scripts\activate
See the Python documentation for more information.
IMPORTANT: Make sure the SWI-Prolog architecture is the same as the Python architecture. If you are using a 64bit build of Python, use a 64bit build of SWI-Prolog, etc.*
Alexander Rødseth maintains the Arch Linux package.
Install PySwip with dependencies using:
sudo pacman -S python-pyswip
Same as the Arch Linux instructions. See: https://manjaristas.org/branch_compare?q=pyswip
Same as the Arch Linux instructions. See: https://www.parabola.nu/packages/?q=python-pyswip
There are no native packages for Debian-based distros. Follow these steps to install PySwip:
-
Install SWI-Prolog:
sudo apt install swi-prolog
If you don't want the X bindings, just use the
swi-prolog-nox
package. -
Install and activate a virtual environment as described before.
-
Install pyswip from Python package index using:
pip install pyswip
-
Run a quick test by running following code at your Python console:
from pyswip import Prolog prolog = Prolog() prolog.assertz("father(michael,john)")
-
Get a recent version of SWI-Prolog from http://www.swi-prolog.org/Download.html and install it.
-
Make sure
swipl
executable is on thePATH
. -
pip install pyswip
-
Run a quick test by running following code at your Python console:
from pyswip import Prolog prolog = Prolog() prolog.assertz("father(michael,john)")
-
Get a recent version of SWI-Prolog from http://www.swi-prolog.org/Download.html and install it.
-
pip install pyswip
-
Make sure
swipl
executable is on thePATH
and the directory that containslibswipl.dylib
is in theDYLD_FALLBACK_LIBRARY_PATH
environment variable. For example, if SWI-Prolog is in/Applications/SWI-Prolog.app
directory, the following may work:export PATH=$PATH:/Applications/SWI-Prolog.app/Contents/swipl/bin/x86_64-darwin15.6.0 export DYLD_FALLBACK_LIBRARY_PATH=/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0
-
Run a quick test by running following code at your Python console:
from pyswip import Prolog prolog = Prolog() prolog.assertz("father(michael,john)")
-
Get a recent version of SWI-Prolog from http://www.swi-prolog.org/Download.html and install it.
-
pip install pyswip
-
Make sure
swipl
executable is on thePATH
and the directory that containslibswipl.dylib
is in theDYLD_FALLBACK_LIBRARY_PATH
environment variable. For example, if SWI-Prolog is in/Applications/SWI-Prolog.app
directory, the following may work:export DYLD_FALLBACK_LIBRARY_PATH=/Applications/SWI-Prolog.app/Contents/Frameworks export PATH=$PATH:/Applications/SWI-Prolog.app/Contents/MacOS
-
Run a quick test by running following code at your Python console:
from pyswip import Prolog prolog = Prolog() prolog.assertz("father(michael,john)")
-
SWI-Prolog can be installed using
pkg
:pkg install swi-pl
-
pip install pyswip
-
Run a quick test by running following code at your Python console:
from pyswip import Prolog prolog = Prolog() prolog.assertz("father(michael,john)")
The following ports don't seem to be maintained anymore.
Till Hofmann maintains the Fedora package.
Install PySwip for Python 3 with dependencies using:
sudo dnf install python3-pyswip
Install PySwip for Python 2 with dependencies using:
sudo dnf install python3-pyswip