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).
3 Interfacing options
<YES>, then click <OK> and <Finish>. Now you can use the
sudo reboot command to reboot the Raspberry Pi.
Step 2: Check that the spi 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 cd SPI-Py sudo python3 setup.py install
This step is for python users, if you use C language, please skip.