Step 1: Enable the SPI port of your Raspberry Pi (If you have enabled it, skip this; if you do not know whether you have done that or not, please continue).
5 Interfacing options
Step 2: Check that the i2c modules are loaded and active.
Then the following codes will appear (the number may be different).
Step 3: Install Python module SPI-Py.
git clone https://github.com/lthiery/SPI-Py.git
sudo python3 setup.py install
Note: This step is for python users, if you use C language, please skip.