“正确的方式"在archlinux上管理多个版本的Python [英] "Proper way" to manage multiple versions of Python on archlinux

查看:103
本文介绍了“正确的方式"在archlinux上管理多个版本的Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我已经读过- https://wiki.archlinux.org/index.php/Python

从此Wiki可以明显看出,我可以通过

And it is clear from this wiki that I can install Python 2.7.2 via

pacman -S python2

对我来说,创建到python2的符号链接是否合理

Is it reasonable for me to create a symlink to python2

ln -s python2 /usr/bin/python

如果我不希望自己很快过渡到python 3.0?还是有更好的方法来管理多个python版本,例如我通常在debian系统(update-alternatives --config python)或mac os x系统(python select)上使用的版本?

if I don't forsee myself switching to python 3.0 any time soon? Or is there a better way of managing multiple python versions like what I usually use on a debian system (update-alternatives --config python) or on a mac os x system (python select)?

澄清:

  • 我想发现的是-在archlinux系统上管理各种python版本的最佳实践"是什么?
  • 我是archlinux的新手,但熟悉ubuntu,debian和mac os x

推荐答案

大多数Uniice已经具有/usr/bin/python.覆盖一个是一个坏主意,因为这是系统中所有软件包使用的Python版本,更改该版本可能会破坏它们.在安装Python 2.7软件包时,可执行文件应安装为/usr/bin/python2.7(如果没有安装,我会认为Archlinux已损坏),最好在运行Python 2.7时使用它.

Most unices already have a /usr/bin/python. Overwriting that one is a bad idea, as this is the Python version used by all packages in the system, and changing that one may break them. When installing the Python 2.7 package the executable should be installed as /usr/bin/python2.7 (if not I would claim Archlinux is broken) and it's better to use that when you want to run Python 2.7.

Archlinux有点特殊,因为它将在Python 3中使用/usr/bin/python,尽管Python 3的默认可执行文件名为/usr/bin/python3.这很令人困惑,并且可以看作是一个错误,但这确实意味着您不能为Python 2使用该符号链接,因为其他任何使用Python 3的Archlinux脚本如果可以的话几乎肯定会损坏.

Archlinux is a bit special, since it will use /usr/bin/python for Python 3, despite the default executable name for Python 3 being /usr/bin/python3. This is confusing and can be seen as a bug, but it does mean you can't use that symlink for Python 2, as any other Archlinux script that uses Python 3 will almost certainly break if you do.

因此在其他Unices上,将/usr/bin/python符号链接到Python 2.7是一个坏主意,在Archlinux上,这是一个糟糕的主意.而是只需安装所需的所有版本,然后使用/usr/bin/pythonX.X对其进行调用.

So where on other Unices, symlinking /usr/bin/python to Python 2.7 is a bad idea, on Archlinux it is a terrible idea. Instead just install all version you need and call them with /usr/bin/pythonX.X.

这篇关于“正确的方式"在archlinux上管理多个版本的Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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