Installing Python 3.7 on CentOS 7 (Python 3.7 not yet available on official repos)

Submitted by aknnn on Sun, 09/30/2018 - 21:26

At the time of writing this, Python 3.7 wasn't available on official repos so the installation process is a bit more nuanced. Still easy enough for beginners.
I would recommend you to login as root to do this since it makes it lot easier. Atleast for me it did.

Install all needed packages:
yum install libffi-devel zlib-devel openssl openssl-devel

yum groupinstall development

Make new directory somewhere for installation files and cd into that directory. You can remove this directory after installation is complete.

(yum install wget, if you don't have the package, if you don't want to install it, you can also manually download the archive from that url)

cd Python-3.7.0/

./configure --enable-optimizations
The --enable-optimizations argument makes some additional optimizations during configuration, this will slow the process a little bit but it usually makes the python run a bit faster.

make altinstall
"altinstall" instead of just "install" is important because this will install Python 3.7 without removing the Python 2.x which is already installed and most likely needed in your system.

Installation is now complete, but your python and pip commands for the new python are "python3.7" and "pip3.7"
It's a little unconvenient to always type the whole version name. Let's make simpler aliases for easier usage:

Edit your main user's (not root) .bashrc to contain these two lines
alias python3="python3.7"
alias pip3="pip3.7"

WARNING: Don't make the alias just "python" because this will most likely break your system. There are still lot's of utilities that are dependent on the python 2.x.

Reload your .bashrc file:
source ~/.bashrc

You should be ready to go!


hi!,I really like your writing so so much! share we
keep in touch extra approximately your article on AOL?
I require an expert in this area to resolve my problem.

Maybe that's you! Looking forward to peer you.

Here is my web-site ... bola88

Add new comment