Since Python 2.6 is included in the standard of CentOS 6.5 and Python 2.7 is included in CentOS 7.2, there are various inconveniences, so install a new version and a frequently used version.
The installation destination is / opt / local
.
** Addendum **
2020/01/10 Addendum: Let's use sloppy Python3.
# yum groupinstall "Development tools"
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
Python 2.7, 3.6 install
First download and install them.
curl -O https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
curl -O https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar zxf Python-3.6.6.tgz
tar zxf Python-2.7.6.tgz
Install Python2.7
cd Python-2.7.6
./configure --prefix=/opt/local
make && make altinstall
Install Python3.6
cd Python-3.6.6
./configure --prefix=/opt/local
make && make altinstall
(2015/07/19: Change the link destination of distribute. Thanks @ mtomoaki_96kg: +1 :)
curl -O https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
tar xzf distribute-0.6.49.tar.gz
cd distribute-0.6.49
/opt/local/bin/python2.7 ./distribute_setup.py
/opt/local/bin/python3.3 ./distribute_setup.py
2015/07/19 Addendum: PIP can be installed without installing distribute / setuptools, so you can skip this step without any problem. Rather, you can install it by running the command pip install distribute
with pip.
see: https://pypi.python.org/pypi/distribute/0.6.49
(Added on 2014/09/27) (2015/04/22 changed from raw.github.com to raw.githubusercontent.com) (2015/07/19 Changed from github to pypa link see: https://pip.pypa.io/en/latest/installing/#install-pip)
> curl -kL https://bootstrap.pypa.io/get-pip.py | /opt/local/bin/python2.7
> curl -kL https://bootstrap.pypa.io/get-pip.py | /opt/local/bin/python3.6
/opt/local/bin/pip2.7 install virtualenv
/opt/local/bin/pip3.6 install virtualenv
thanks sahiruha: +1:
--http://www.petitec.com/2013/04/ Put python2-7 in centos6 /
2018/10/04: The Python version number recommended by PIP was> = 2.7.9,> = 3.4, so the part described as 3.3 was changed to 3.6.
Recommended Posts