linux 安裝 pyhton python
下載文件
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xzlinux
解壓 xz文件
xz -d Python-3.8.0.tar.xzsql
tar -xvf Python-3.8.0.tar測試
首先安裝gcc編譯器,gcc有些系統版本已經默認安裝,經過 gcc --version 查看,沒安裝的先安裝gcc,yum -y install gcc.net
安裝其它依賴包,(注:不要缺乏,不然有可能安裝python出錯,python3.7.0如下的版本可不裝 libffi-devel )
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 libffi-develorm
創建一個空文件夾,用於存放python3程序 sqlite
mkdir /usr/local/python3 ip
cd Python-3.8.0
./configure --prefix=/usr/local/python3
make && make installssl
-- 創建軟鏈接
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3get
測試:==》
[root@mini Python-3.7.0]# python3
Python 3.7.0 (default, Jul 28 2018, 22:47:29)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hello world!")
hello world!
>>> exit()
[root@mini Python-3.7.0]# pip3 --version pip 10.0.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)