如何在CentOS上将Python3.5.2设置为默认Python版本? [英] How to set Python3.5.2 as default Python version on CentOS?

查看:155
本文介绍了如何在CentOS上将Python3.5.2设置为默认Python版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将CentOS 7上的Python 3.5.2设置为默认Python版本?目前,我已默认安装了Python 2.7,并分别安装了Python 3.5.2.

Is there a way to set the Python 3.5.2 as the default Python version on CentOS 7? currently, I have Python 2.7 installed as default and Python 3.5.2 installed separately.

我使用了以下命令

mv /usr/bin/python /usr/bin/python-old
sudo ln -fs /usr/bin/python3 /usr/bin/python

,但此后yum给出错误.

-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

我这里缺少什么吗?

注意:它与推荐答案

如果是

sudo ln -fs /usr/bin/python3.5 /usr/bin/python

不起作用(应该)

您可以使用以下命令将别名添加到您的/home/.bashrc中:

you could just add an alias into your /home/.bashrcwith this command:

alias python="/usr/bin/python3.5"

,如果这不起作用,则应仅使用虚拟环境.阅读此页面即可开始.

and if this does not work either you should just use virtual env. Read this page to get started.

这篇关于如何在CentOS上将Python3.5.2设置为默认Python版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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