由于功能及程序依赖,需要将Centos上的python从2.6升级成2.7,把碰到的一些问题记录如下:
安装好2.7后将原来的/usr/bin/python改成/usr/bin/python26,并将2.7的bin目录加入执行路径
Question1: 执行yum报No module named yum
[root@zejin240 ~]# yum list
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.12 (default, Jul 6 2016, 18:40:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
解决方法:
vi /usr/binyum
#!/usr/bin/python26
Question2: 执行pip时提示 ImportError: No module named pip
解决方法:python -m ensurepip
Questions3:源码安装paramiko出现各种模块找不到
解决方法:
pip install -I pycrypto pip install -I paramiko
|