Trying to install python 3.8 from source in CentOS 7.9.
The default installed python is 2.7.5 and is located at /usr/bin.
sudo yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel
sudo cd /opt
sudo wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz
sudo tar xzf Python-3.8.12.tgz
cd Python-3.8.12
sudo ./configure --enable-optimizations
sudo make install
I thought make install
would create python3
in /usr/bin, but it didn’t.
2
Answers
By default, CPython install compiled python binary in
/usr/local/bin/python
. (source code: https://github.com/python/cpython/blob/main/configure#L571) You may specify the prefix mannually asconfigure --prefix=/usr
.You need to set symlinks such as
The above works great in CentOS7 after installing Python3.8 as noted above.