How to install Python 3.5, Python 3.7 and Anaconda distribution on Centos

How to install python 3.5 on Centos

yum install gcc
cd /usr/src

tar -xvf Python-3.5.6.tgz
cd Python-3.5.6

For better optimizations run make with --enable-optimizations, this will run Unit tests

./configure --enable-optimizations

If you dont want to make it python3.5 default then do make install; otherwise make altinstall

make install

Type Python 3.5, and you should see the Python3.5 shell


lets install python 3.7 version now

cd ..
cd Python-3.7.3.tgz
tar -xvf Python-3.7.3.tgz
cd Python-3.7.3
./configure --enable-optimizations
make install

I got following error , if you dont see the error that means you are good

#ModuleNotFoundError: No module named '_ctypes'

If you see the above error, install following library and make configure, make and make install commands again

yum install libffi-devel
./configure --enable-optimizations
make install

You might also run in to following error...

Ignoring ensurepip failure: pip 9.0.1 requires SSL/TLS

To fix, install following...

yum install zlib-devel bzip2-devel sqlite sqlite-devel openssl-devel

Now do make install again

make install

Lets also install Conda python package manager

chmod +x

Lets add to env path

export PATH=$PATH:/home/anaconda3/bin/

If you dont want to auto initialize anaconda on login set following

conda config --set auto_activate_base false

lets create a python 3.7 environment now using conda create -n yourenvname python=x.x anaconda

conda create -n condapy373 python=3.7.3 anaconda

To activate Conda env

conda init bash
conda activate condapy373

To update Conda, you can run following command...

conda update -n base -c defaults conda

That's it you have Conda with python 3.7 installed now

Related Topics:

Python Scrapy Tutorial Python Scrapy