py-nrf24 icon indicating copy to clipboard operation
py-nrf24 copied to clipboard

Python version confusion

Open HilmarSt opened this issue 1 month ago • 0 comments

I was using a Pi Zero W with Python 3.9 :

$ python --version
Python 3.9.2

After following the "Quick installation of pigpio on Raspbian:" in README.md :

$ sudo apt-get update    
$ sudo apt-get install pigpio python-pigpio python3-pigpio

the default Python version changed to 2.7 :

$ python --version
Python 2.7.18

Calling simple-receiver.py with "python" gives an error:

$ python simple-receiver.py
  File "simple-receiver.py", line 34
    print(f'Invalid address {address}. Addresses must be between 3 and 5 ASCII characters.')

...but works with "python3"

$ python3 simple-receiver.py
Python NRF24 Simple Receiver Example.
Connecting to GPIO daemon on localhost:8888 ...

Which of the packages in "sudo apt-get install pigpio python-pigpio python3-pigpio" are necessary to have the example working without automatically installing Python v2.7 ?

update:

$ sudo apt-get install python-is-python3

The following packages were automatically installed and are no longer required:
  libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python2 python2-minimal python2.7 python2.7-minimal
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  python-is-python2 python-pigpio
...

$ python --version
 Python 3.9.2

$ python simple-receiver.py
... works

HilmarSt avatar May 16 '24 08:05 HilmarSt