python更新后yum问题
生活随笔
收集整理的這篇文章主要介紹了
python更新后yum问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
python更新后yum問題
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 pythonThere are 2 programs which provide 'python'.Selection Command ----------------------------------------------- *+ 1 /usr/bin/python3.42 /usr/bin/python2.7Enter to keep the current selection[+], or type selection number: 2 [root@localhost fedora]# python -V Python 2.7.8
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 pythonThere are 2 programs which provide 'python'.Selection Command ----------------------------------------------- *+ 1 /usr/bin/python3.42 /usr/bin/python2.7Enter 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 packageFile "/usr/bin/yum", line 30except KeyboardInterrupt, e:^ SyntaxError: invalid syntax If you set python3 globally on your system change the yumshebang 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 28except 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 posted on 2016-12-24 13:55 Kilichko 閱讀(...) 評論(...) 編輯 收藏轉載于:https://www.cnblogs.com/Yemilice/p/6217250.html
總結
以上是生活随笔為你收集整理的python更新后yum问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Oracle优化笔记
- 下一篇: [bzoj2127]happiness