Installing Python3 on CentOS 7

# Configure MariaDB repo ( optional )
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

# Run as root
# For MariaDB-devel, please configure yum.repos.d properly before running this command
yum install zlib-devel openssl-devel MariaDB-devel
yum groupinstall "Development tools"

$ Run as local user
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
# --enable-shared is need if you want to install mod_wsgi
./configure --enable-optimizations --enable-shared
make && make test

# Run as root
make altinstall

If pip is not installed

# Download this as local user
wget https://bootstrap.pypa.io/get-pip.py

# Run these as root
/usr/local/bin/python3.6 get-pip.py

# This will enable virtualenv for all local users
pip install virtualenv

mod_wsgi ( optional )

You'll need to compile wsgi yourself because that's how much we love CentOS

Download latest release from github:
mod_wsgi releases

# Run as root
yum install httpd-devel

# This exports the LB_LIBRARY_PATH for python3
echo "export LD_LIBRARY_PATH=/usr/local/lib" > /etc/profile.d/python3.sh

$ Run as local user
# Go find the latest version
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.5.15.tar.gz

./configure --with-python=/usr/local/bin/python3.6
make

# Run as root
make install

Afterward, enable mod_wsgi on apache2's config dir.
Tag(s): python3 centos 7
Profile picture
斟酌 鵬兄
Tue Feb 21 2017 04:39:29 GMT+0000 (Coordinated Universal Time)
Last modified: Thu May 04 2017 03:53:08 GMT+0000 (Coordinated Universal Time)
Comments
No comments here.
Do you even comment?
website: 
Not a valid website
Invalid email format
Please enter your email
*Name: 
Please enter a name
Submit
抱歉,Google Recaptcha 服務被牆掉了,所以不能回覆了