did proper install for your github site, tried to run smooth.py --code could not find pantilthat
File “smooth.py”, line 6, in
import pantilthat
ImportError: No module named pantilthat
any help appreicated.
regards, Tom
did proper install for your github site, tried to run smooth.py --code could not find pantilthat
File “smooth.py”, line 6, in
import pantilthat
ImportError: No module named pantilthat
any help appreicated.
regards, Tom
That likely means the install actually targeted a different Python version than what you’re using. What’s the output of:
python --version
pip list | grep pantilthat
pip3 list | grep pantilthat
?
pi@raspberrypi:~ $ python --version
Python 2.7.16
pi@raspberrypi:~ $ pip list | grep pantilthat
WARNING: You are using pip version 20.1.1; however, version 21.1.3 is available.
You should consider upgrading via the ‘/usr/bin/python3 -m pip install --upgrade pip’ command.
pi@raspberrypi:~ $ pip3 list | grep pantilthat
WARNING: You are using pip version 20.1.1; however, version 21.1.3 is available.
You should consider upgrading via the ‘/usr/bin/python3 -m pip install --upgrade pip’ command.
pi@raspberrypi:~ $
OK, so it looks like:
smooth.py
under Python 2, butpantilthat
Python library isn’t installed at allTry doing the manual install documented at GitHub - pimoroni/pantilt-hat: Python library for the Pimoroni PanTilt servo and lighting HAT, then run pip list | grep pantilthalt
again. Assuming you see it listed now, then try smooth.py
again.
here’s another output using an openCV shell that i hope to use with pantilt
pi@raspberrypi:~ $ source start_py3cv4.sh
Starting Python 3.7 with OpenCV 4.1.1 bindings…
(py3cv4) pi@raspberrypi:~ $ python --version
Python 3.7.3
(py3cv4) pi@raspberrypi:~ $ pip list | grep pantilthat
pantilthat 0.0.7
WARNING: You are using pip version 20.1.1; however, version 21.1.3 is available.
You should consider upgrading via the ‘/home/pi/.virtualenvs/py3cv4/bin/python -m pip install --upgrade pip’ command.
(py3cv4) pi@raspberrypi:~ $ pip3 list | grep pantilthat
pantilthat 0.0.7
WARNING: You are using pip version 20.1.1; however, version 21.1.3 is available.
You should consider upgrading via the ‘/home/pi/.virtualenvs/py3cv4/bin/python -m pip install --upgrade pip’ command.
here’s what i got
(py3cv4) pi@raspberrypi:~ $ sudo apt-get install python3-pantilthat
Reading package lists… Done
Building dependency tree
Reading state information… Done
python3-pantilthat is already the newest version (0.0.7).
The following package was automatically installed and is no longer required:
rpi-eeprom-images
Use ‘sudo apt autoremove’ to remove it.
0 upgraded, 0 newly installed, 0 to remove and 341 not upgraded.
(py3cv4) pi@raspberrypi:~ $ pip list | grep pantilthalt
WARNING: You are using pip version 20.1.1; however, version 21.1.3 is available.
You should consider upgrading via the ‘/home/pi/.virtualenvs/py3cv4/bin/python -m pip install --upgrade pip’ command.
(py3cv4) pi@raspberrypi:~ $
works! thanks
(py3cv4) pi@raspberrypi:~/Pimoroni/pantilthat/examples $ python smooth.py
-89
-89
-89
-89
-89
-89
-89
-89
-89
-89
-89
-89
-89
-89
-89
CTraceback (most recent call last):
File “smooth.py”, line 26, in
time.sleep(0.005)
KeyboardInterrupt
(py3cv4) pi@raspberrypi:~/Pimoroni/pantilthat/examples