“make install"和“make install"之间的细节差异和“make altinstall" [英] Difference in details between "make install" and "make altinstall"

查看:24
本文介绍了“make install"和“make install"之间的细节差异和“make altinstall"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况:

我正在使用 Ubuntu 10.04 (Lucid Lynx).系统默认的 Python 是 v2.6.5,但我需要 Python v2.7.所以我从python.org下载了源代码并尝试安装它.

我第一次安装它时,我跑了:

cd Python2.7.4./configure --prefix=/usr制作苏根进行安装

这会将 Python 2.7 安装到我的系统中.它将在 /usr/bin 中创建一个链接python",链接到 python2.7 也在 /usr/bin 中.所以当我输入>python时,系统会为我启动Python 2.7.4,就像我输入>python2.7一样.

但是当我这样安装时:

cd Python2.7.4./configure --prefix=/usr制作苏根进行安装

/usr/bin 中的链接python"仍然存在,并且链接到默认系统版本python2.6.当然,我可以删除它并创建一个链接到 python2.7 的新软链接.

make install"和make altinstall"命令有什么区别,除了/usr/bin中的链接?

解决方案

我们来看看生成的Makefile!

一、安装目标:

install: altinstall bininstall maninstall

它可以完成 altinstall 所做的一切,以及 bininstallmaninstall

这是bininstall;它只是创建 python 和其他符号链接.

# 通过创建符号链接链安装解释器:# $(Python) ->python2 ->蟒蛇$(版本))# 还为其他已安装的文件创建等效链二进制安装:altbininstall-if 测试 -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON);然后 rm -f $(DESTDIR)$(BINDIR)/$(PYTHON);否则为真;菲(cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))-rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))...(创建了更多链接)

这里是 maninstall,它只是创建了未版本化"的链接到 Python 手册页.

# 安装未版本化的手册页手动安装:altmaninstall-rm -f $(DESTDIR)$(MANDIR)/man1/python2.1(cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python2.1)-rm -f $(DESTDIR)$(MANDIR)/man1/python.1(cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python2.1 python.1)

TLDR:altinstall 跳过创建 python 链接和手册页链接,install 将隐藏系统二进制文件和手册页.>

Here is my case:

I am using Ubuntu 10.04 (Lucid Lynx). The system's default Python is v2.6.5, but I need Python v2.7. So I downloaded the source from python.org and tried to install it.

The first time I installed it, I ran:

cd Python2.7.4
./configure --prefix=/usr
make
su root
make install

This installs Python 2.7 to my system. It will create a link, "python", in /usr/bin linking to python2.7 also in /usr/bin. So when I type >python, the system will start Python 2.7.4 for me just like when I type >python2.7.

But when I install this way:

cd Python2.7.4
./configure --prefix=/usr
make
su root
make altinstall

The link "python" in /usr/bin still exists and links to python2.6 which is the default system version. Of course, I can remove it and create a new soft link linking to python2.7.

What is the difference between the command "make install" and "make altinstall", except for the link in /usr/bin?

解决方案

Let's take a look at the generated Makefile!

First, the install target:

install:         altinstall bininstall maninstall

It does everything altinstall does, along with bininstall and maninstall

Here's bininstall; it just creates the python and other symbolic links.

# Install the interpreter by creating a symlink chain:
#  $(PYTHON) -> python2 -> python$(VERSION))
# Also create equivalent chains for other installed files
bininstall:     altbininstall
        -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); 
        then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); 
        else true; 
        fi
        (cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
        -rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
        (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
        ... (More links created)

And here's maninstall, it just creates "unversioned" links to the Python manual pages.

# Install the unversioned manual pages
maninstall:     altmaninstall
        -rm -f $(DESTDIR)$(MANDIR)/man1/python2.1
        (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python2.1)
        -rm -f $(DESTDIR)$(MANDIR)/man1/python.1
        (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python2.1 python.1)

TLDR: altinstall skips creating the python link and the manual pages links, install will hide the system binaries and manual pages.

这篇关于“make install"和“make install"之间的细节差异和“make altinstall"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆