python更新后yum问题
How to switch between Python versions on Fedora Linux
Currently, the default python version on Fedora Linux is Python 2. Later
Fedora Linux release 22 will ship with the Python 3 as a default
version. In this config you will learn how to switch between python
versions on Fedora Linux. Let's start by listing all Python versions
available on your Fedora system:
# ls /usr/bin/python*
/usr/bin/python /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.4m /usr/bin/python-coverage
/usr/bin/python2 /usr/bin/python2-coverage /usr/bin/python3.4 /usr/bin/python3-mako-render
Now, check your default python version:
# python -V
Python 2.7.8
To change python version on per user basis simply create a new alias in you .bashrc
located under your home directory:
$ alias python='/usr/bin/python3.4'
$ . ~/.bashrc
$ python --version
Python 3.4.2
To change python version globally first check whether python alternative version is already registered by alternatives
command:
# alternatives --list | grep -i python
No output means not alternative python version is configured yet. Register the two above listed python version with alternative
command.
# alternatives --install /usr/bin/python python /usr/bin/python3.4 2
# alternatives --install /usr/bin/python python /usr/bin/python2.7 1
The above commands will instruct alternatives
command to create relevant symbolic links to be used anytime a python
command is executed. We have also given python3.4
a higher priority 2
which means, if no python alternative is selected the python3.4
will be used as default. After execution of the above commands your python version should change to python3.4
due to its higher priority.
# python -V
Python 3.4.1
To switch between above alternative python version is now simple as:
# alternatives --config python There are 2 programs which provide 'python'. Selection Command
-----------------------------------------------
*+ 1 /usr/bin/python3.4
2 /usr/bin/python2.7 Enter to keep the current selection[+], or type selection number: 2
[root@localhost fedora]# python -V
Python 2.7.8
1. Appendix
Known problems with Fedora Linux and Python 3 version: Error message:
# yum search package
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax
If you set python3 globally on your system change the yum
shebang to python2:
# vi /usr/bin/yum
FROM:
#!/usr/bin/python
TO:
#!/usr/bin/python2.7
Similarly: Error message:
Downloading packages:
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
Exiting on user cancel
The issue is also related to Python 3 set as a default global version. To fix this error update /usr/libexec/urlgrabber-ext-down
script:
# vi /usr/libexec/urlgrabber-ext-down
FROM:
#!/usr/bin/python
TO:
#!/usr/bin/python2.7
python更新后yum问题的更多相关文章
- CENTOS下Python 升级后YUM无法使用的解决办法
Python有很多实用的工具,安装依赖python版本较高,升级Python后导致yum无法使用. 原因: 系统自带的yum依赖Python老版本,升级后不兼容 解决办法: 1. 列出所有版本,确定老 ...
- 如何解决python升级后yum报错
当我们yum命令的时候,会提示 "File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxEr ...
- 手动下载python更新后 换回以前版本
因为用的时Ubuntu略低版本的,不想更新版本,但是经常更新内核和其他软件,尤其是最近自己更新python,但是软件更新救出错了,而且不能打开“Languae Support”(软件支持)和ibus输 ...
- 解决修改完系统默认python版本后yum不可用的问题!!!!!!
文章转自: http://www.linuxidc.com/Linux/2013-05/84727.htm #vi /usr/bin/yum 将文件头部的: #!/usr/bin/python 改为: ...
- Python更新后ros用不了的bug
一.原因 我同时安装了python2.7 和3.5,而且将python默认配置为python3.5,所以ros并不支持,所以提示找不到. 2.解决方式 通过修改不同版本的python的优先级,将pyt ...
- linux中python环境搭建及升级后yum不可用解决方案
1.1 LinuxCentOS 为例.1.1.1 升级 Python(1) 下载 Python 版本$ wget https://www.python.org/ftp/python/2.7.11/Py ...
- CentOS 6.5升级Python后yum不可用的解决方案
因开发需要,今天把CentOS 6.5自带的Python2.6.6升级到了Python2.7.3.按照如下步骤进行升级 1.查看当前系统python的版本 python -V 2.下载2.7.3版本的 ...
- CentOS6 系统下升级python后yum命令使用时报错
CentOS6 系统下升级python后yum命令使用时报错,如下: [root@xxxxxxx]#yumFile"/usr/bin/yum",line30exceptKeyboa ...
- CentOS7 升级python同时解决yum损坏问题
CentOS7中的python版本为python2.7.5,升级到最新版的python时需要注意两个问题 新版的python安装好后要修改python的系统默认指向问题 升级到最新版python后yu ...
随机推荐
- [Java编程思想-学习笔记]第2章 一切都是对象
2.1 创建新的数据类型:类 通过第一章掌握了面向对象的理论后,我们知道每个对象必定属于一个类型,那么Java如何创建新的数据类型?如下程序所示: class Circle { // 属性 // 方 ...
- 在数组中找出x+y+z=0的组合
就是找x+y=-z的组合 转化为找出值为-z满足x+y=-z的组合 解法一: 为了查找,首先想到排序,为了后面的二分,nlogn, 然后x+y的组合得n^2的复杂度,加上查找是否为-z,复杂度为nlo ...
- 使用强大的可视化工具redislive来监控我们的redis,别让自己死的太惨~~~
作为玩windows的码农,在centos上面装点东西,真的会崩溃的要死,,,我想大家也知道,在centos上面,你下载的是各种源代码,需要自己编译...而 使用yum的话,这个吊软件包有点想nuge ...
- Windows驱动——虚拟机 虚拟串口 双机调试
=================================版权声明================================= 版权声明:原创文章 谢绝转载 请通过右侧公告中的“联系邮 ...
- [已解决]从微软合作伙伴资源和MSDN下载系统和软件Microsoft download Manager无效
有个itellyou,更新了所有MSDN的软件包.如果自己有微软的注册账户,还是从微软官网下载比较好.而且对自己账户里的系统和itellyou里的做了对比.发现SHA1码不相同,估计官方分配的序列号也 ...
- 关于Web报表FineReport打印的开发应用案例
报表打印是报表使用和开发过程中经常碰到的问题,这里汇总了关于Web报表开发打印功能的一些典型应用案例,以应用最广泛的FineReport为例. 案例一:java直接调用报表打印 当java后台定义定时 ...
- 【原】如何改变表单元素的外观(for Webkit and IE10)
表单元素在网页设计中使用的非常频繁,如文本输入框.单选框.复选框.选择列表.上传文件,它们在浏览器中的展现有自带的外观,为了在视觉上取得更好的产品体验,保持客户端的统一,通常产品经理会提出需要改变它的 ...
- CF731C. Socks[DFS 贪心]
C. Socks time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...
- java Socket编程-基于UDP
package com.wzy.UDPTest; import java.net.DatagramPacket; import java.net.DatagramSocket; import java ...
- [No00007F]2016-面经[下] 英文简历写作技巧
一.简历种类 1.中式 中式简历中,常包括政治面貌,性格及身高体重等.如果中英文简历一起递交,建议中文不写政治面貌,因为如果去外企工作,背景中的政治色彩越少越好,起码没有必要让老外知道. 性格是一个主 ...