forked from yuce/pyswip
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathINSTALL
91 lines (59 loc) · 2.77 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
PySWIP INSTALL
==============
PySWIP requires SWI-Prolog as a shared library since it uses ctypes to access
SWI-Prolog/C functions. The shared library is present in the Win32 installer,
but missing by default from the builds made directly from the source.
Installing on Linux
-------------------
These instructions are tested on a Linux system, but should also work for POSIX
systems. Also, you may want to install development packages for readline,
libncurses, and libgmp.
You need to do the following to install a shared library enabled version of
SWI-Prolog. We use version 6.0.2 of SWI-Prolog. Please make the necessary
modifications for your environment.
1) Get the source from http://www.swi-prolog.org/download/stable:
$ wget http://www.swi-prolog.org/download/stable/src/pl-6.0.2.tar.gz
2) Extract the archive and cd into it:
$ tar xzvf pl-6.0.2.tar.gz
$ cd pl-6.0.2.tar.gz
3) Configure the source with shared library enabled:
$ ./configure --enable-shared
*** If using a 64-bit system, you may have to compile with the -ggdb flag in
order to get PySWIP to work with SWI-Prolog without segfaults (But not
necessarily. YMMV.):
$ CFLAGS=-ggdb ./configure --enable-shared
4) Compile the source:
$ make
5) Install the source:
$ sudo make install
6) *** This is perhaps no longer relevant, as it appears clp is installed by
default with SWI-Prolog clp library is useful for constraint handling
problems, so let's install that too:
$ cd cd packages/clpqr
$ ./configure --enable-shared
$ make && make install
7) If you are not using Python 2.5 or later, you should install ctypes, or get a
new version of Python (apt-get is fine if you're using Ubuntu).
8) Unpack PySwIP package and install it with, ``python setup.py install``.
9) After you install it, you can test it with the following at your Python shell::
>>> 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 shared
library. Check your default library directory (usually ``/usr/lib``) for
``libswipl.so``.
Installing on Win32
-------------------
1) Get a recent version of SWI-Prolog for Win32 from:
http://www.swi-prolog.org/dl-stable.html and install it.
2) You need to add SWI-Prolog's bin directory ``C:\Program Files\pl\bin`` to
*path*, here are two tutorials for that:
http://www.computerhope.com/issues/ch000549.htm and
http://vlaurie.com/computers2/Articles/environment.htm
3) Get a Windows installer version of PySWIP and install it.
4) After you install it, you can test it with the following at your Python
console::
>>> from pyswip import Prolog
>>> prolog = Prolog()
>>> prolog.assertz("father(michael,john)")