CentOS release 6.8
CentOS yum seems to work only with the pre-installed version of Python. So, if you install the latest version of Python, your system may break, so you shouldn't do it. Therefore, it seems to use the trick of installing Python under / usr / local. The procedure for squid is described in How to install the latest version of Python on CentOS. The procedure remains the same.
I heard that I have to download development tools
# Compilers and related tools:
yum groupinstall -y "development tools"
# Libraries needed during compilation to enable all features of Python:
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel
# If you are on a clean "minimal" install of CentOS you also need the wget tool:
yum install -y wget
Then wget the source code for Python 2 and 3 and compile it
# Python 2.7.13:
wget http://python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz
tar xf Python-2.7.13.tar.xz
cd Python-2.7.13
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
# Python 3.6.0:
wget http://python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xf Python-3.6.0.tar.xz
cd Python-3.6.0
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
I don't know what you're doing, but I've done this for the time being
strip /usr/local/lib/libpython2.7.so.1.0
strip /usr/local/lib/libpython3.6m.so.1.0
Next is the installation of pip, but there seems to be a Python script for that, wget it and execute it.
# First get the script:
wget https://bootstrap.pypa.io/get-pip.py
# Then execute it using Python 2.7 and/or Python 3.6:
python2.7 get-pip.py
python3.6 get-pip.py
Now you can use pip install
! Yay!
Recommended Posts