

This can be accomplished by using a custom prefix (for example /usr/local) when running configure, and using make altinstall (instead of the normal make install) when installing your build of Python. Installing other versions works fine as long as you leave the original system version alone. You are not supposed to change the system version of Python because it will break the system (as you found out). # With pip installed you can now do things like this: # Then execute it using Python 2.7 and/or Python 3.6: Strip /usr/local/lib/libpython3.6m.so.1.0 configure -prefix=/usr/local -enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" configure -prefix=/usr/local -enable-unicode=ucs4 -enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" The next steps depend on the version of Python you're installing. # If you are on a clean "minimal" install of CentOS you also need the wget tool: 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

# Libraries needed during compilation to enable all features of Python: It currently covers Python 2.7.13 and Python 3.6.0: # Start by making sure your system is up-to-date: I have written a quick guide on how to install the latest versions of Python 2 and Python 3 on CentOS 6 and CentOS 7.
