CentOS7安裝Python3.7

說明

所有操做都在root用戶下執行

1.安裝編譯相關工具

1 yum -y groupinstall "Development tools"
2 yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
3 yum install libffi-devel -y

 

2.下載安裝包解壓

1 cd #回到用戶目錄
2 wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
3 tar -xvJf Python-3.7.0.tar.xz

 

3.編譯安裝

1 mkdir /usr/local/python3 #建立編譯安裝目錄
2 cd Python-3.7.0
3 ./configure --prefix=/usr/local/python3
4 make && make install

 

4.建立軟鏈接

1 ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
2 ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3

 

5.驗證是否成功

1 python3 -V
2 pip3 -V

 

相關文章
相關標籤/搜索