Centos6更改默认Python2.x为Python3.x以及注意事项_yum,ibus的异常处理

更换Python默认版本
本文介绍如何将系统默认的Python版本从Python2.6更改为Python3.5.2,包括修改系统符号链接、调整yum配置及修复ibus输入法兼容性问题。

更换默认python版本

运行pycharm的时候,发现pycharm看不起默认的python2.6,加上项目要用python3.x,所以我要改一下默认使用的版本
在这里插入图片描述

修改python3为默认的python

[root@master ~]# which python
/usr/bin/python
[root@master ~]# which python2.6
/usr/bin/python2.6
[root@master ~]# mv /usr/bin/python /usr/bin/python.bak
[root@master ~]# ln -s /root/Python-3.5.2/python /usr/bin/python
[root@master ~]# python -V
Python 3.5.2
[root@master ~]# python2.6 -V
Python 2.6.6

由于yum用的python仍然是2.6,修改一下yum

把原来的 #!/usr/bin/python 修改成 #!/usr/bin/python2.6

[root@master ~]# vim /usr/bin/yum
[root@master ~]# head /usr/bin/yum
#!/usr/bin/python2.6
import sys
try:
    import yum
except ImportError:
    print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   %s

由于ibus要使用python2.6,也要修改(别问我怎么知道的,问就是自闭了好久)

python变成默认python3之后,导致的ibus输入法不可用,当你发现自己的ibus输入法不可用的时候,请注意查看是否这里出现更新python的问题

问题现象描述:

  1. centos6.6中System-》Preferences-》input method中设置ibus,点击input method preferences 没有反应;2:右上角pannel中没有输入法选择。
  2. 尝试过重新安装,ibus,使用yum install 安装咯,无法解决。
  3. 最终 解决方法:是在terminal中打开/usr/libexec/ibus-ui-gtk,/usr/ bin/ibus-setup,/usr/libexec/ibus-engine-table并把其中到“exec python”改为“exec python2.6”

vim 中全局修改替换命令 :s/python/python2.6/g

自己是直接找到 这个文件,然后使用编辑工具打开,然后改成我的centos的原始版本 2.6.6 ,更改保存,注销,重新进入。完美解决。

在这里插入图片描述

参考自: https://blog.csdn.net/happy_bigqiang/article/details/50885522

[root@MiWiFi-R1CM-srv ~]# preupg --riskcheck --verbose INPLACERISK: EXTREME: You have GNOME Desktop Environment session as an option in your X11 session manager. GNOME Desktop Environment as a part of the yum group 'Desktop' underwent serious redesign in its user interface as well as underlying technologies in CentOS 7. INPLACERISK: HIGH: You have some of the KDE Desktop yum group packages installed in your system. KDE Desktop Environment that was provided by this group of packages underwent a redesign in its user interface as well as underlying technologies in CentOS 7. INPLACERISK: HIGH: We detected some non-CentOS signed packages, you can find the list in /root/preupgrade/./kickstart/noncentospkgs. You need to handle them yourself! INPLACERISK: HIGH: After upgrading to CentOS 7 there are still some el6 packages left. Add --cleanup-post option to redhat-upgrade-tool if you want to remove them automatically. INPLACERISK: HIGH: There were changes in SELinux policies between CentOS 6 and CentOS 7. Please, check solution in order to resolve this issue. INPLACERISK: HIGH: File /etc/rc.d/rc.local was changed INPLACERISK: MEDIUM: Your last X11 session loaded module 'mga' that was deprecated in CentOS 7. INPLACERISK: MEDIUM: We detected some packages installed on the system were removed (obsoleted) between CentOS 6 and CentOS 7. This may break the functionality of the packages depending on them. INPLACERISK: MEDIUM: We detected some packages installed on the system were removed between CentOS 6 and CentOS 7. This may break the functionality of the packages depending on them. INPLACERISK: MEDIUM: Package xorg-x11-drv-cirrus not provided by its replacement xorg-x11-drv-modesetting. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql2100-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package rt61pci-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package xorg-x11-drv-mga not provided by its replacement xorg-x11-drv-modesetting. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package coreutils-libs not provided by its replacement coreutils. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package rt73usb-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql2400-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql2200-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package redhat-lsb-graphics not provided by its replacement redhat-lsb-desktop. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package NetworkManager-gnome not provided by its replacement nm-connection-editor,network-manager-applet. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package bfa-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ibus-pinyin not provided by its replacement ibus-libpinyin. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package libudev not provided by its replacement systemd-libs. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql23xx-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package ql2500-firmware not provided by its replacement linux-firmware. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: Package xorg-x11-drv-ast not provided by its replacement xorg-x11-drv-modesetting. In-place upgrade might not work properly, will be finished by postupgrade script! INPLACERISK: MEDIUM: having one of [glx-utils redhat-menus kpartx tzdata mesa-libGLU openscap] package installed breaks upgrade INPLACERISK: MEDIUM: We detected some soname bumps in the libraries installed on the system. This may break the functionality of some of your 3rd party applications. They may need rebuild. Please check their requirements. INPLACERISK: MEDIUM: We detected some .so libraries installed on the system were removed between CentOS 6 and CentOS 7. This may break the functionality of some of your 3rd party applications. INPLACERISK: SLIGHT: We detected some files where modifications are not tracked in the rpms. You may need to check their functionality after successful upgrade. INPLACERISK: SLIGHT: We detected some files untracked by rpms. Some of these may need manual check/migration after redhat-upgrade-tool and/or can cause conflicts or troubles during the installation. Try to reduce unnecessary untracked files before running redhat-upgrade-tool. INPLACERISK: SLIGHT: We detected some packages installed on the system changed their name between CentOS 6 and CentOS 7. Although they should be compatible, monitoring after the update is recommended. INPLACERISK: SLIGHT: Some binaries untracked by RPM were discovered on the system and may need rebuild after upgrade. INPLACERISK: SLIGHT: Some scripts untracked by RPM were discovered on the system and may not work properly after upgrade. INPLACERISK: SLIGHT: /usr/lib64/python2.6/site-packages/gtk-2.0 is owned by an RPM package that was not signed by CentOS. INPLACERISK: SLIGHT: /usr/lib64/python2.6/site-packages/report is not owned by any RPM package. INPLACERISK: SLIGHT: /usr/lib64/python2.6/site-packages/reportclient is not owned by any RPM package.
最新发布
10-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值