在安裝python3.9時遇到CentOS8默認(rèn)安裝了3.6版本,無法默認(rèn)使用3.9版本的問題鞋邑,特此記錄
安裝python3.9
參考文章
安裝完成伟阔,查看linux系統(tǒng)上的python版本
>>>python3
Python 3.6.8 (default, Aug 24 2020, 17:57:11)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
>>>python3 --version
Python 3.6.8
>>>pip3 --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
查看一下路徑
>>> which python3
/usr/bin/python3
>>> which pip3
/usr/bin/pip3
>>> cd /usr/bin/
>>> ls -an python3
lrwxrwxrwx. 1 0 0 25 3月 31 12:20 python3 -> /etc/alternatives/python3
>>> ls -an pip3
lrwxrwxrwx. 1 0 0 22 3月 31 12:20 pip3 -> /etc/alternatives/pip3
查看一下所有python3相關(guān)的鏈接
>>>ls -an python3*
lrwxrwxrwx. 1 0 0 25 3月 31 12:20 python3 -> /etc/alternatives/python3
lrwxrwxrwx. 1 0 0 31 11月 4 12:04 python3.6 -> /usr/libexec/platform-python3.6
lrwxrwxrwx. 1 0 0 32 11月 4 12:04 python3.6m -> /usr/libexec/platform-python3.6m
找到python3.9的文件录豺,非目錄
-rwxr-xr-x. 1 root root 20436336 3月 31 20:50 python3.9
使用上面找到的目錄進(jìn)行鏈接修改
>>>ln -sb /usr/local/bin/python3.9 /usr/bin/python3
>>>python3 --version
Python 3.9.0a1
>>>ln -sb /usr/local/bin/pip3.9 /usr/bin/pip3
>>>pip3 --version
pip 19.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
驗證一下python的版本現(xiàn)在是不是已經(jīng)是3.9了
>>>python3
Python 3.9.0a1 (default, Mar 31 2021, 20:49:23)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
搞定跷车!
PS:設(shè)定安裝源
1.mkdir ~/.pip
2.vim ~/.pip/pip.conf
增加如下內(nèi)容
[global]
timeout = 6000
index-url = https://pypi.douban.com/simple
trusted-host = pypi.douban.com
如果有用記得點個贊链方,留個言牵现,讓我知道這篇文章真的有用铐懊,謝謝