1

As I read from forums, Python2 is removal at bullseye. I install python2.7 manually but there is gpio problem with python2.

sudo python2.7 -m pip install RPi.GPIO

dont work. Raises

 collect2: error: ld returned 1 exit status
 error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

And very long error log. Do you have any suggestions?

Edit:

sudo python2.7 -m pip install --upgrade pip
sudo python2.7 -m pip install pyparsing
sudo python2.7 -m pip install pyparser
sudo apt-get install libffi-dev
sudo apt-get install libzbar-dev
sudo apt-get install clang
sudo apt-get install python-dev
sudo apt-get install libssl-dev
sudo apt-get install build-essential

used and still dont work.

2 Answers 2

2
sudo CFLAGS="-fcommon" pip install RPi.GPIO

Solved my problem.

3
  • 1
    Why are you still using Python2?
    – CoderMike
    Dec 16, 2021 at 9:25
  • 1
    I just don't want to port all my python2 codes to python3.. Dec 16, 2021 at 10:54
  • Congratulations for resolving your issue, and posting the answer here - that helps others. ICYI, you can "accept" your own answer - but you might have to wait a day or two before the system allows you to do that.
    – Seamus
    Dec 17, 2021 at 9:07
0

I ran into this today, when upgrading a particularly old system from Stretch through Buster to Bullseye and the Bullseye upgrade broke a script I had running. sudo apt install python3-rpi.gpio is what you want to upgrade to the Python 3 version of RPi.GPIO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.