Home > Software engineering >  How to install python 3.8 directly in /usr/bin?
How to install python 3.8 directly in /usr/bin?

Time:11-22

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.

CodePudding user response:

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 as configure --prefix=/usr.

  • Related