How I install python 3.8 on centos 7

 Issue : 

when I want to install python 3.8 on my centos server and direct download from server with extension tar.gz

it will extract and I will run  

sudo ./configure --enable-optimizations

and it shown 

configure: error: in `/home/user/Python-3.8.12':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details


solution :

I install old version python 3.6 via yum and it will replaced with newest version from your download

sudo yum update -y

sudo yum install -y python3

and now python 3.6 installed on your system
check with

python3

will show 

Python 3.6.8 (default, Aug 7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>

now replace with new one

download dependency builder

sudo yum install gcc openssl-devel bzip2-devel libffi-devel -y

download your python if you dont have gz file 

curl -O https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz


extract this file 
tar -xzf Python-3.8.1.tgz

now go to your extract directory 

cd Python-3.8.1/

and you can type 
./configure --enable-optimizations

it should be success no error and will generate Makefile and the console will be

configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Misc/python.pc
config.status: creating Misc/python-embed.pc
config.status: creating Misc/python-config.sh
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
creating Modules/Setup.local
creating Makefile


if it done run the last command to build to executable file
make altinstall


and its done
check it with command
python3.8

will out
Python 3.8.12 (default, Mar 12 2022, 09:41:14)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.


yes it installed 2 verstion,  if you wnt to run first python3 to run your installation from yum and python3.8 to run from your own build

thanks and hope it help 



Comments