我正在运行Redhat VM(2.6.18-274.el5 64位)。我在vm上安装了nodejs以便使用browserstack。要让nodejs运行,我必须将Python升级到2.6或更高版本。我使用make altinstall从源代码安装了2.7。然后我创建了一个指向2.4到2.7的硬链接。检查python -V现在显示2.7是默认值。这一切都很好,节点现在正在运行。
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.2 (default, Jul 2 2012, 23:35:52)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq
我的问题是百胜。它不再像寻找旧版Python 2.4那样工作了吗?无论如何我可以让它们在Yum和节点中都使用不同的版本吗?
答案 0 :(得分:1)
这里有两个问题。一个是你打破了你的系统python。 Yum安装在python的站点包中。如果你损坏python,yum会破坏。打破系统python安装是一个愚蠢的想法。也许你做了备份,或者有另一台姊妹机,你可以移植原来的2.4 python。
另一个问题是在同一台机器上安装几个蟒蛇没有问题。要安装Node.js,您必须告诉它使用哪个python。在运行PYTHON=/opt/local/my/path/to/python2.7/bin/python
之前设置PYTHONHOME
,可能还有./configure
。
答案 1 :(得分:0)
你永远不应该覆盖系统Python;太多的脚本依赖于了解该解释器的行为。您可以在/usr/local
中安装较新版本的Python,然后使用Python包virtualenv
根据需要进一步隔离您的环境。