raspberry pi 4 , Python 2.7

Viewed 63

I install latest OS to my new raspberry pi 4. I have a lot of code on old rpi3 in python 2.7, but none of it works on python 3.9. I managed to install python 2.7 on the new RPI4, but I'm having big problems with PIP. Python 2.7 have no module. Now is PIP and PIP3 all for python 3. How do I route pip to python2.7 and pip3 to python3.9 ? I try

sudo apt-get  install pip

eading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'python3-pip' instead of 'pip'
python3-pip is already the newest version (20.3.4-4+rpt1+deb11u1).
The following packages were automatically installed and are no longer required:
  docutils-common libfuse2 mypy pylint python3-astroid python3-asttokens
  python3-docutils python3-isort python3-jedi python3-lazy-object-proxy
  python3-logilab-common python3-mccabe python3-mypy python3-mypy-extensions
  python3-parso python3-pygments python3-roman python3-send2trash python3-toml
  python3-typed-ast python3-typing-extensions python3-wrapt sgml-base xml-core
  xsel
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 198 not upgraded.

I want install REQUESTS to python 2.7

pip install requests
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.25.1)

Module is still missing in Python 2.7

Thankyou

1 Answers

Try <python2.7 binary path> -m pip install requests. For example in my machine it would be python2.7 -m pip install requests in yours could be just python -m pip install requests

Related