I followed the link. I removed the directory and changed my default python version and ran the build_python_demos.sh script again.
When I run the command sequence in your post, I receive:
pi@raspberrypi:~ $ which python
/usr/bin/python
pi@raspberrypi:~ $ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 24 Mar 29 19:52 /usr/bin/python -> /etc/alternatives/python
If I run python --version in the terminal I get:
pi@raspberrypi:~ $ python --version
Python 3.9.2
The code still only works when I run it with python2. When I try to run it in Thonny or Visual Studio Code with python3, I get the following error:
pi@raspberrypi:~/pixy2/build/python_demos $ /bin/python3 /home/pi/pixy2/build/python_demos/get_blocks_python_demo.py
Traceback (most recent call last):
File “/home/pi/pixy2/build/python_demos/get_blocks_python_demo.py”, line 2, in
import pixy
File “/home/pi/pixy2/build/python_demos/pixy.py”, line 15, in
import _pixy
ImportError: /home/pi/pixy2/build/python_demos/_pixy.so: undefined symbol: PyInstance_Type
If I run it with " python2 get_blocks_python_demo.py " it works fine. If I could, I’d just run it in python2 and call it a day. But my program requires pygame, which dropped all support for python2.