~~How to install Python3 on CentOS 7
- Before installation
You need to install the dependent packages in order to let your python3 work perfectly after the installation.
Enter those code in the terminal
yum install -y zlib-devel bzip2-devel ncurses-devel gcc openssl-devel sqlite-devel tk-devel gdbm expat-devel gcc-C++ readline-devel
- Install Python
Step1 : download packages
Choose or build a folder you would like to download the installation packages of python using ‘cd’ & ‘mkdir’ command
cd ~ # make sure you are in the home directory
mkdir Packages/
cd Packages/
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz # This command will download the installation packege to the folder you built
ps. try not to use python - 3.7.0, there’s some problem with it.
Step2 : install
When the downloading process is complete, you need to decompress the package and begin to install Python3
tar -zvxf Python-3.6.6.tgz
cd Python-3.6.6.
./configure --prefix=/usr/local/python/python3
make
make install
Step3: build soft connection
This is like build a short cut. You can call python without referring to its installed folder.
ln -s /usr/local/python/python3/bin/python3 /usr/bin/python3 # the latter path should be '/usr/local/python3' in case it may conflict with the built-in python of CentOS (version 2.7.5)
Step4: Use your Python!
enter ‘python3’ in the terminal
