If you have trouble installing Python 3.8 or Pip 3.8 on Amazon Linux 2, please refer to it.
$ sudo yum -y update
$ sudo yum -y install gcc openssl-devel bzip2-devel libffi-devel
$ wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
$ tar xzf Python-3.8.1.tgz
$ cd Python-3.8.1
$ sudo ./configure --enable-optimizations
$ sudo make altinstall
$ python3.8 --version
Python 3.8.1
$ pip3.8 --version
pip 19.2.3 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
Make a symbolic link through the path so that Python 3.8 can be used from root as well.
$ sudo which python3.8
which: no python3.8 in (/sbin:/bin:/usr/sbin:/usr/bin)
$ sudo visudo
(Before)
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
(After)
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
$ sudo which python3.8
/usr/local/bin/python3.8
$ sudo ln -s /usr/local/bin/python3.8 /usr/local/bin/python3
$ sudo which python3
/usr/local/bin/python3
$ sudo ln -s /usr/local/bin/pip3.8 /usr/local/bin/pip3
$ sudo which pip3
/usr/local/bin/pip3
Recommended Posts