奥尔覅几22 发表于 2018-8-10 09:15:53

Linux Python-KillMySQL的博客

Centos 6.4 python 2.6升级到 2.7
python2.7.X下载安装
1.查看python的版本
  # python -V
  Python 2.6.6
2.下载Python-2.7.8
  #wgethttp://python.org/ftp/python/2.7.8/Python-2.7.8.tgz
3.解压
  root@zyl python]#tar xf Python-2.7.8.tgz
4.切换目录
  # cd /Python-2.7.8
5.安装
  # ./configure --prefix=/usr/local/python27
  #make
  # make install
  最新2.7.8版本的python已经安装到了系统中,但是还没有完成
  再次查看python版本,发现依然是2.6.6版本
  #python -V
  Python 2.6.6
python多版本共存解决
  1.把原来的python重命名成python_old,注意不要删除它
  # mv /usr/bin/python /usr/bin/python_old
  2.建立新的python的软连接
  # ln -s /usr/local/python27/bin/python /usr/bin/
  3. 再查看一下版本,发现ok
  #python -V
  Python 2.7.8
  至此我们已经可以正常使用python2.7.X
解决yum的python版本问题
  但是我们还有最后一个问题要解决:但是因为yum是使用的python2.4的版本,所以,还需要修改一下(前面我们重命名的python_old现在派上用场)
  # yum
  There was aproblem importing one of the Python modules
  required to runyum. The error leading to this problem was:
  No module namedyum
  Please install apackage which provides this module, or
  verify that themodule is installed correctly.
  It's possiblethat the above module doesn't match the
  current versionof Python, which is:
  Python 2.7.8(default, Dec3 2014, 10:51:34)
   on linux2
  If you cannotsolve this problem yourself, please go to
  the yum faq at:
  http://wiki.linux.duke.edu/YumFaq
  # vim /usr/bin/yum
  #!/usr/bin/python   #修改此处为2.6的位置
  # vim/usr/bin/yum
  #!/usr/bin/python2.6
  # yum
  Loaded plugins:fastestmirror
  You need to givesome command
  usage: yum COMMAND
  List of Commands:
  check-update   Check for available package updates
  clean          Remove cached data
  deplist      List a package's dependencies
  downgrade      downgrade a package
  erase          Remove a package or packages fromyour system
  groupinfo      Display details about a package group
  groupinstall   Install the packages in a group on yoursystem
  grouplist      List available package groups
  groupremove    Remove the packages in a group from yoursystem
  help         Display a helpful usage message
  info         Display details about a package orgroup of packages
  install      Install a package or packages on yoursystem
  list         List a package or groups of packages
  localinstall   Install a local RPM
  yum 可以使用;python升级成功。
页: [1]
查看完整版本: Linux Python-KillMySQL的博客