python - 删除默认 Python 2.7 后在 CentOS 上重新安装 Python

标签 python bash centos

这个问题在这里已经有了答案:





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

(1 个回答)


2年前关闭。




我正在使用 Bluehost 云服务器,它有 CentOs 6.10 (linux 2.6.32-754.14.2.e16.x86_64) , 我正在尝试安装 python 3.7 ,但不知何故删除了centOS中默认的python2.6(从lib,lib64,bin ....中删除)。

现在当我尝试使用 yum 时,它给出了一个错误:

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



我应该怎么做才能重新安装 python 2.6,这样 yum 才能工作?

目前 python 3.7.1 正在运行(/root/python/Python-3.7.1/python),但我无法安装 pip 或任何其他 python 包,如 numpy。

任何帮助将非常感激。
提前致谢。

最佳答案

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

If you were to restore the /usr/lib/python2.6 directory from another system you would at least be able to run yum again, although your system would still be fundamentally broken. Your best bet is to reinstall from scratch

关于python - 删除默认 Python 2.7 后在 CentOS 上重新安装 Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57427393/

相关文章:

json - 将 "="分隔值文件转换为 ":"json 文件

bash - 如何引用 glob 模式中匹配的内容

mongodb - 在运行 MongoDB 的 CentOS 服务器上为操作系统保留 RAM

python - 如何在 CentOS 上为 python 2.6 安装模块?

python - 在 flask-sqlalchemy 中使用具有相同模型的多个数据库

python - 为每个 numpy 列分配不同的权重

python - 如何使用 jquery 调用 python 函数?

python - Django 中的嵌套 View - Python

linux - 如何仅在其他一些命令成功运行后才运行命令?

mysql - 使用 bash 脚本在 CentOS 6 VM (Vagrant) 上安装 MySQL