-
Notifications
You must be signed in to change notification settings - Fork 13
1.5 Compiling Python
pytamgu is a library that is compatible with both python and tamgu. In other words, you can import pytamgu in a Python program and execute tamgu scripts as if it was some Python code. Containers and strings are automatically converted in both directions.
If you want to compile with a specific version of Python (for instance with Python 3), you should use "-pythoninclude", which should point to the python "include" directory.
The library can be compiled either with Python 2.7 or Python 3.x...
See the doc for information on how to use it... In fact, pytamgu only exposes two methods. One to load a tamgu program (load), the second to execute a function exported by this tamgu program (execute). See below for an example.
In the case of Mac OS, the Makefile compiles a version of pytamgu, with python2.7, which the default installation of Python on Mac OS. However, if you have installed a specific version of python such as Python 3.7, you need to provide this version as an argument of the install.py script:
python install.py -pythonversion 3.7
python install.py -version fedora -intel -pythoninclude /usr/include/python3.6m -pythonversion 3.6m
The code for pytamgu is in: libpython
The -version option allows for the compiling of different versions in the same directory. We choose fedora here as a name for this specific compiling, but you can choose whatever name you want. The name is not binding to a specific compiler or a specific OS.
When you launch install.py, the system returns the list of libraries that are missing. These missing libraries does not mean that tamgu will not compile, but that some of the tamgu libraries in the list above might not compile by lack of specific libraries.