这不是重复的,因为建议的文章引用了一个一般问题。我的问题是指安装两个版本后如何修复路径。
我在 RHEL 7 中工作,不小心在 Python3.5 之上安装了 Python2.7 ......长话短说,它发生了。我的脚本需要使用 2.7。我尝试创建一个符号链接并且有效,但 yum 仍然无法正常工作。此外,如果我使用 pip 安装任何东西,它会将其放入 /usr/local/lib/python3.5/site-packages。建议如何解决这个问题?我已经在谷歌上搜索了几个小时,我正在拔头发。先感谢您。
点子版本:
# pip --version
pip 8.0.2 from /usr/local/lib/python3.5/site-packages (python 3.5)
创建到 2.7 版本的链接:
# ln -s /usr/local/bin/python2.7 /usr/bin/python
蟒蛇位置:
# which python
/usr/bin/python
检查版本:
# python
Python 2.7.11 (default, Mar 3 2016, 08:44:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>quit()
尝试使用百胜:
# yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.11 (default, Mar 3 2016, 08:44:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
卸载/重新安装后 pip 版本没有改变
# pip --version
pip 8.0.2 from /usr/local/lib/python3.5/site-packages (python 3.5)