Created
June 28, 2017 01:34
-
-
Save Ivlyth/738a717bc45989a1404477761c3aafbf to your computer and use it in GitHub Desktop.
使用Makefile 在 centos 6.x 系统上一键安装 python2.7 并安装 virtualenvwrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env ?=upy | |
PYTHON_VENV := $(env) | |
version ?=2.7.10 | |
PYTHON_VERSION := $(version) | |
PYTHON_DIR := Python-$(PYTHON_VERSION) | |
all: task-install-venv-wrapper | |
@ echo 'All done ...' | |
clean: | |
@ rm -rf $(PYTHON_DIR) task-* | |
task-init-os: | |
@ yum -y groupinstall "Development Tools" | |
@ yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel | |
@ touch task-init-os | |
task-uncompression-python: task-init-os | |
@ echo 'uncompress python source code ...' | |
@ tar xJf Python-$(PYTHON_VERSION).tar.xz | |
@ touch task-uncompression-python | |
task-build-python: task-uncompression-python | |
@ echo "build Python-$(PYTHON_VERSION) from source code ..." | |
- @ mkdir /opt/python$(PYTHON_VERSION) | |
@ cd Python-$(PYTHON_VERSION) && ./configure --prefix=/opt/python$(PYTHON_VERSION) --enable-unicode=ucs4 && make && make install | |
@ touch task-build-python | |
task-install-pip: task-build-python | |
@ tar -xf setuptools-23.0.0.tar.gz | |
@ cd setuptools-23.0.0 && /opt/python$(PYTHON_VERSION)/bin/python setup.py install | |
@ tar -xf pip-8.1.2.tar.gz | |
@ echo "installing pip ..." | |
@ cd pip-8.1.2 && /opt/python$(PYTHON_VERSION)/bin/python setup.py install | |
@ echo "undating pip by self ..." | |
- @ mkdir ~/.pip | |
@ cp pip.conf ~/.pip/ | |
@ /opt/python$(PYTHON_VERSION)/bin/pip install -U pip | |
@ touch task-install-pip | |
task-install-venv-wrapper: task-install-pip | |
@ /opt/python$(PYTHON_VERSION)/bin/pip install pbr | |
@ /opt/python$(PYTHON_VERSION)/bin/pip install virtualenvwrapper | |
@ touch task-install-venv-wrapper | |
@ echo "install virtual env wrapper done ." | |
run: clean | |
.DEFAULT: all | |
.PHONY: all clean run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment