How to Install Python 3 and pip 3 for CentOS 6
CentOS 6 doesn’t have native support for Python 3 and corresponding module management tool ‘pip’. I prefer pip for managing my Python modules. On CentOS 7 there is a specific yum package for pip(Python 2.7) and pip3(Python 3.4) respectively. However on COS 6 we must install the ‘epel repository’ to get Python 3.4 and there is no specific package for installing ‘pip 3’. This tutorial is a friendly reminder for myself and others on how to install Python3 & pip3 for CentOS 6.x.
Goals of this post:
- Install Python 3.4
- Install pip3
- Upgrade pip3
First install epel repo.
Next we want to install the basic Python 3.4 packages and setup tools.
Don’t forget the devlopment package. We’ll need that so pip can compile Python modules!
Now we can use setup tools to install pip3. Change directory to /usr/lib/python3.4/site-packages/.
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 9.0.1
Downloading https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
Processing pip-9.0.1.tar.gz
Writing /tmp/easy_install-i57cd5_e/pip-9.0.1/setup.cfg
Running pip-9.0.1/setup.py -q bdist_egg –dist-dir /tmp/easy_install-i57cd5_e/pip-9.0.1/egg-dist-tmp-a5l61208
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: ‘python_requires’
warnings.warn(msg)
warning: no previously-included files found matching ‘.coveragerc’
warning: no previously-included files found matching ‘.mailmap’
warning: no previously-included files found matching ‘.travis.yml’
warning: no previously-included files found matching ‘.landscape.yml’
warning: no previously-included files found matching ‘pip/_vendor/Makefile’
warning: no previously-included files found matching ‘tox.ini’
warning: no previously-included files found matching ‘dev-requirements.txt’
warning: no previously-included files found matching ‘appveyor.yml’
no previously-included directories found matching ‘.github’
no previously-included directories found matching ‘.travis’
no previously-included directories found matching ‘docs/_build’
no previously-included directories found matching ‘contrib’
no previously-included directories found matching ‘tasks’
no previously-included directories found matching ‘tests’
creating /usr/lib/python3.4/site-packages/pip-9.0.1-py3.4.egg
Extracting pip-9.0.1-py3.4.egg to /usr/lib/python3.4/site-packages
Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /usr/bin
Installing pip3 script to /usr/bin
Installing pip3.4 script to /usr/bin
Installed /usr/lib/python3.4/site-packages/pip-9.0.1-py3.4.egg
Processing dependencies for pip
Finished processing dependencies for pip
[root@localhost site-packages]#
Finally lets upgrade pip 3 to latest version. Now we have a up to date Python packages compatible with CentOS 7 and later Fedora versions!
Requirement already up-to-date: pip in ./pip-9.0.1-py3.4.egg
[root@localhost site-packages]#
Looks like we are up to date. Lets install the Python automation tool, ‘Fabric’ as a test.
Collecting fabric
Using cached Fabric-1.13.2.tar.gz
Collecting paramiko<3.0,>=1.10 (from fabric)
Using cached paramiko-2.1.2-py2.py3-none-any.whl
Collecting cryptography>=1.1 (from paramiko<3.0,>=1.10->fabric)
Using cached cryptography-1.9.tar.gz
Requirement already satisfied: pyasn1>=0.1.7 in /usr/lib/python3.4/site-packages (from paramiko<3.0,>=1.10->fabric)
Requirement already satisfied: idna>=2.1 in /usr/lib/python3.4/site-packages (from cryptography>=1.1->paramiko<3.0,>=1.10->fabric)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python3.4/site-packages (from cryptography>=1.1->paramiko<3.0,>=1.10->fabric)
Requirement already satisfied: six>=1.4.1 in /usr/lib/python3.4/site-packages (from cryptography>=1.1->paramiko<3.0,>=1.10->fabric)
Requirement already satisfied: cffi>=1.7 in /usr/lib/python3.4/site-packages (from cryptography>=1.1->paramiko<3.0,>=1.10->fabric)
Requirement already satisfied: pycparser in /usr/lib/python3.4/site-packages (from cffi>=1.7->cryptography>=1.1->paramiko<3.0,>=1.10->fabric)
Installing collected packages: cryptography, paramiko, fabric
Running setup.py install for cryptography … done
Running setup.py install for fabric … done
Successfully installed cryptography-1.9 fabric-1.13.2 paramiko-2.1.2
[root@localhost site-packages]#
Thanks for reading, I hope I saved you some time!
4 Comments »
RSS feed for comments on this post. TrackBack URL
I came across an Unbuntu tutorial: https://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/
[…] If you need help setting up Python3, pip, and Fabric on CentOS 6 please refer to my earlier tutorial: https://www.savelono.com/linux/how-to-install-python-3-and-pip-3-for-centos-6.html […]
[…] If you need help installing Python3, pip3 and Fabric please refer to my previous post. […]
[…] For help installing Fabric look at my previous post: https://www.savelono.com/linux/how-to-install-python-3-and-pip-3-for-centos-6.html […]