|
INSTALL
PySWIP INSTALL(Updated for version 0.2) PySWIP requires SWI-Prolog as a shared library since it uses ctypes to access SWI-Prolog/C functions. The shared library is present in Win32 installer, but missing by default from the builds made directly from the source. Installing on LinuxThese instructions are tested on a Linux system, but should also work for POSIX systems. Also, you may want to install development packages for readline and libgmp (not required for basics). You need to do the following to install a shared library enabled version of SWI-Prolog. We use version 5.6.34 of SWI-Prolog but any other recent version should work fine. Please make the necessary modifications for your environment.
$ wget http://gollem.science.uva.nl/cgi-bin/nph-download/SWI-Prolog/pl-5.6.34.tar.gz $ tar xzvf pl-5.6.34.tar.gz $ cd pl-5.6.34 $ ./configure --prefix=/usr --enable-shared $ make $ sudo make install $ cd cd packages/clpqr $ ./configure --prefix=/usr --enable-shared $ make && sudo make install $ sudo ln -s /usr/lib/pl-5.6.34/lib/i686-linux/libpl.so.5.6.34 /usr/lib/libpl.so $ tar xzvf pyswip-X.X.X $ sudo python setup.py install >>> from pyswip import Prolog
>>> prolog = Prolog()
>>> prolog.assertz("father(michael,john)")If you get an error, such as "libpl (shared) not found." or "FATAL ERROR: Resource not found" be sure you have installed SWI-Prolog as a share library. Check your default library directory (usually /usr/lib) for libpl.so. Installing on Win32
>>> from pyswip import Prolog
>>> prolog = Prolog()
>>> prolog.assertz("father(michael,john)") |
Running on Vista I got the problem even though libpl.dll (SWI-Prolog 5.6.64) is is actually registered path. Any idea? Thanks in advance
wget http://gollem.science.uva.nl/cgi-bin/nph-download/SWI-Prolog/pl-5.6.34.tar.gz will give a timeout error and I guess 5.6.34 does not exist anymore.
Using the latest instead (5.10.1) and doing a softlink from /usr/lib/swipl-5.10.1/lib/i686-linux/libswipl.so to /usr/lib/libpl.so seems to work for me.
Please, anyone knows another place to download the 5.6.34 Prolog's version? The latest (5.10.x) is not working!
Eruyome, i did what you said, but it not works. When i run "from pyswip import Prolog" it asks for the "libpl" archive, but the name of what we use is "libswipl". What did you do?
The new versions (5.10.x) don't have libpl.dll :(
FIX FOR SWI-Prolog 5.10.x:
1. Navigate to the SWI-Prolog bin directory. On Windows this is C:\Program Files\pl\bin by default.
2. Copy "swipl.dll" and rename the copy to "libpl.dll"
3. Profit!
I cannot seem to run any prolog Query (under python 2.7\2.6\3.2..) Using windows, i installed using the instructions - and even the examples cannot run.
for example, running hanoi.py: hanoi.py", line 64, in main
WindowsError?: exception: access violation writing 0x00000001i cannot do any queries, it tells me that there is a QueryWrapper? ignored
Here's what I did as of March 5th, 2012 to get this to work (in easy copy-and-paste format, for those brave enough to trust me ;P):
Then fire up the Python shell and try out the example above and hopefully everything works! :D