Cento7安裝Python3

一.解決依賴python

 

yum install  zilb-devel python3-devel ncurses-libs zlib-devel mysql-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-develmysql

二.下載python3sql

wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz

# 解壓
xz -d Python-3.6.1.tar.xz
tar -xvf Python-3.6.1.tar.xz

三.安裝bash

cd Python-3.6.1
sudo ./configure --prfix=/usr/local/python3 --# 將資源文件都解壓到這裏enable-optimizations

# 編譯 & 安裝
sudo make & make install

四.建立軟連接markdown

sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3

  sudo ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3python2.7

 

# 最後:spa

  在終端輸入python3,便可code

  安裝py3的模塊,須要用 pip3 install xxx 去安裝。sqlite

  python2.7正常使用,切記千萬不要覆蓋掉 python2.7的軟連接,由於yum依賴於py2.7blog

相關文章
相關標籤/搜索