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.

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
(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!

Comments

whoah this blog is wonderful i love studying your posts.

Stay up the great work! You understand, many individuals are looking round for this info,
you can help them greatly.

Also visit my homepage: Business and Leadership (Michele)

I loved as much as you'll receive carried out right here.
The sketch is attractive, your authored material stylish.
nonetheless, you command get got camera an ninh
impatience over that you wish be delivering the following.
unwell unquestionably come more formerly again as exactly
the same nearly very often inside case you shield this hike.

certainly like your web-site but you have to check
the spelling on quite a few of your posts. A number of them are rife with spelling issues and I in finding it very troublesome to inform the truth then again I will definitely
come back again.

my website: mch job circular

Hi there I am so grateful I found your blog page, I really
found you by mistake, while I was searching on Aol for something else, Regardless
I am here now and would just like to say thank you
for a fantastic post and a all round enjoyable blog (I
also love the theme/design), I don't have time to look over
it all at the moment but I have book-marked it and also added in your RSS
feeds, so when I have time I will be back to read more, Please do keep up the superb job.

Feel free to visit my page; BCEFP Exams

Wonderful site. A lot of helpful information here.
I am sending it to several pals ans also sharing in delicious.
And of course, thanks for your effort!

Feel free to visit my blog; NagaPoker

Add new comment