I created a new AL2 EC2. I see Python 2 is already installed.
How can I upgrade this to Python 3 WITHOUT using virtualenv? I would like to maintain ONLY ONE version of Python.
I created a new AL2 EC2. I see Python 2 is already installed.
How can I upgrade this to Python 3 WITHOUT using virtualenv? I would like to maintain ONLY ONE version of Python.
WARNING: it may break yum
, because yum
uses python2!!!
Make sure you don't have it already:
ls /usr/bin/python*
/usr/bin/python /usr/bin/python2.7 /usr/bin/python2-config /usr/bin/python3.7 /usr/bin/python-config
/usr/bin/python2 /usr/bin/python2.7-config /usr/bin/python3 /usr/bin/python3.7m
if you do have and don't like to use python3
instead of just python
, then
python --version
Python 2.7.18
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
python --version
Python 3.7.10
You might also want:
ln -s /usr/bin/pip3 /usr/bin/pip
pip --version
pip 20.2.2 from /usr/lib/python3.7/site-packages/pip (python 3.7)