Centos7中安裝Python3
阿新 • • 發佈:2018-02-01
bzip dbm readline 安裝 nss 最新 cap article 依賴
環境:CentOS 7
1. 安裝依賴環境
# 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
2. 瀏覽器打開 https://www.python.org/ftp/python/ 查看最新的Python版本,標記為3.A.B
# wget https://www.python.org/ftp/python/3.A.B/Python-3.A.B.tgz
3. 創建Python3的目錄
# mkdir /usr/local/python3
4. 解壓下載文件並切換目錄
# tar -zxvf Python-3.A.B.tgz
# cd Python-3.A.B
5. 執行
# ./configure --prefix=/usr/local/python3
# make && make install
6. 創建Python3的軟鏈接
# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
7. 創建Pip3的軟鏈接
# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
8. 測試命令 python3 和 pip3
# python3
# pip3
安裝保留了原python命令調用python2
安裝完成
文章來自:http://blog.csdn.net/x_koozal/article/details/72432906
Centos7中安裝Python3