Python安装:make install和make altinstall的差别
Lasted 2020-01-04 15:51:46
Linux系统中源码安装Python3时,编译时使用make install和make altinstall之间存在一定区别。
不同操作系统可能有一定的差别,本文使用的操作系统为Centos7。
查看源文件Makefile,可以看出两者之间的差异:
install:  commoninstall bininstall maninstall 
	if test "x$(ENSUREPIP)" != "xno"  ; then \
		case $(ENSUREPIP) in \
			upgrade) ensurepip="--upgrade" ;; \
			install|*) ensurepip="" ;; \
		esac; \
		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
			$$ensurepip --root=$(DESTDIR)/ ; \
	fi
altinstall: commoninstall
	if test "x$(ENSUREPIP)" != "xno"  ; then \
		case $(ENSUREPIP) in \
			upgrade) ensurepip="--altinstall --upgrade" ;; \
			install|*) ensurepip="--altinstall" ;; \
		esac; \
		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
			$$ensurepip --root=$(DESTDIR)/ ; \
	fi
文件显示,make install会执行commoninstall、bininstall、maninstall三个过程,而make altinstall只执行commoninstall过程。
1. make install命令会创建符号链接。
make install命令执行后,/usr/local/bin目录情况:
ll /usr/local/bin|grep python
lrwxrwxrwx... python3 -> python3.8 -rwxr-xr-x... python3.8 -rwxr-xr-x... python3.8-config lrwxrwxrwx... python3-config -> python3.8-config
make altinstall命令执行后,/usr/local/bin目录情况:
ll /usr/local/bin|grep python
-rwxr-xr-x... python3.8 -rwxr-xr-x... python3.8-config
2. make altinstall不会创建软链和手册相关信息。