安裝成功以後,就可以查看 Python 的版本了:
# python -V
Python2.7
# python3 -V
Python3.6.2
設置 3.x 爲默認版本
查看 Python 的路徑,在 /usr/bin 下面。可以看到 python 鏈接的是 python 2.7,所以,執行 python 就相當於執行 python 2.7。
#ls-al /usr/bin | greppython
將原來 python 的軟鏈接重命名:
# mv /usr/bin/python /usr/bin/python.bak
將 python 鏈接至 python3:
# ln -s /usr/local/bin/python3 /usr/bin/python
這時,再查看 Python 的版本:
# python -V
Python3.6.2
輸出的是 3.x,說明已經使用的是 python3了。