Linux安裝Python 3.8.1

1、安裝所需依賴

[[email protected] ~]# yum -y install wget gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel

2、下載Python3.8.1

[[email protected] ~]# wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz

3、設置語言

[[email protected] ~]# echo "LANG=zh_CN.UTF-8" >> /etc/profile
[[email protected] ~]# echo "LANGUAGE=zh_CN.UTF-8" >> /etc/profile
[[email protected] ~]# . /etc/profile

4、解包並編譯安裝

[[email protected] ~]# tar zxf Python-3.8.1.tgz -C /usr/src
[[email protected] ~]# cd /usr/src/Python-3.8.1/
[[email protected] Python-3.8.1]# ./configure --prefix=/usr/local/python38 --enable-optimizations && make && make install

5、配置環境變量

[[email protected] Python-3.8.1]# echo "PATH=$PATH:/usr/local/python38/bin" >> /etc/profile
[[email protected] Python-3.8.1]# . /etc/profile

6、查看python的版本

[[email protected] Python-3.8.1]# python3 --version
Python 3.8.1

———————— 本文至此結束,感謝閱讀 ————————

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章