I have a legacy script that uses Python2 (which I can't modify). It imports module yaml. On older machines, this is satisfied using pip install pyyaml
.
I'm using a newly built Ubuntu laptop which has had apt install python2
done. However, there is only a python3 version of pip available. The command python2 -m pip install pyyaml
says there is no module named pip. I cannot do apt install python2-pip
or anything like apt install python2-pyyaml
or python2-yaml
or similar as there are no such packages available any more. Is there an easy way I can install module yaml for python2 now that python2 is unsupported?
Just do a curl for the following to install pip for python2:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
Then run
sudo python2 get-pip.py
You can then use the command pip2 --version
tp check if pip is installed and for the correct version of python.