4 Installation
The plan is simple: install Python 3.10 then tell pyffi where Python is installed.
Optional: install NumPy if you want to use pyffi/numpy.
4.1 Python 3.10
In order to use pyffi you need Python 3.10.
The official distribution of Python is here: https://www.python.org/downloads/
If you prefer to use an alternative source of distribution (read your favorite package manager), that’s fine too - as long as it includes both the standard interpreter as well as the shared library libpython.
4.2 One-time Configuration
The last installation step consists of telling pyffi where your shared library libpython is placed.
The easiest way of doing this is to run the script configure-pyffi.
Open a terminal.
Check that python3 or python invokes your Python interpreter.
Run: raco pyffi configure
If the command python3 is not in your path, then you can write this instead:
raco pyffi configure <path-to-your-python-command>
This will find the location of your shared library, print it, and, store it in your Racket preferences under the key pyffi:libdir.
You are now ready to use pyffi.
4.3 Optional: NumPy for scientific computing
The Python package NumPy has the slogan:
The fundamental package for scientific computing with Python.
If you want to use pyffi/numpy then you need to install NumPy in your Python environment first.
There are many ways of installing NumPy, but the simplest is to use the following in a terminal:
python3 -m pip install numpy