“Proper way” to manage multiple versions of Python on archlinux

前端 未结 7 946
不知归路
不知归路 2020-12-15 18:24

So I have read this - https://wiki.archlinux.org/index.php/Python

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

pacman -S pytho         


        
7条回答
  •  爱一瞬间的悲伤
    2020-12-15 18:37

    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 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.

    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.

提交回复
热议问题