有没有办法将 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.
这篇关于如何在 CentOS 上将 Python3.5.2 设置为默认 Python 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
python:不同包下同名的两个模块和类python: Two modules and classes with the same name under different packages(python:不同包下同名的两个模块和类)
配置 Python 以使用站点包的其他位置Configuring Python to use additional locations for site-packages(配置 Python 以使用站点包的其他位置)
如何在不重复导入顶级名称的情况下构造python包How to structure python packages without repeating top level name for import(如何在不重复导入顶级名称的情况下构造python包)
在 OpenShift 上安装 python 包Install python packages on OpenShift(在 OpenShift 上安装 python 包)
如何刷新 sys.path?How to refresh sys.path?(如何刷新 sys.path?)
分发带有已编译动态共享库的 Python 包Distribute a Python package with a compiled dynamic shared library(分发带有已编译动态共享库的 Python 包)