如何在 CentOS 上将 Python3.5.2 设置为默认 Python 版本?
- 作者: 黄某某007
- 来源: 51数据库
- 2023-01-06
问题描述
有没有办法将 Python 3.5.2 设置为 CentOS 7 上的默认 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 给出了错误.
but after that yum gives the error.
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
这里有什么我遗漏的吗?
is there something I'm missing here?
注意:它与 Linux CentOS 7,如何设置Python2.7为默认Python版本?
推荐答案
如果这样
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.
推荐阅读
热点文章
Discord.py(重写)on_member_update 无法正常工作
0
Discord.py 在 vc 中获取用户分钟数
0
discord.py 重写 |为我的命令出错
0
Discord.py rewrite 如何 DM 命令?
0
播放音频时,最后一部分被切断.如何解决这个问题?(discord.py)
0
在消息删除消息 Discord.py
0
如何使 discord.py 机器人私人/直接消息不是作者的人?
0
(Discord.py) 如何获取整个嵌入内容?
0
Discord bot 尽管获得了许可,但不能提及所有人
0
Discord.py discord.NotFound 异常
0
