第一次接觸python,本次只為配置python3的運行環境;參考博客:https://www.cnblogs.com/kimyeee/p/7250560.html
Linux下安裝Python3.6和第三方庫
如果本機安裝了python2,盡量不要管他,使用python3運行python腳本就好,因為可能有程序依賴目前的python2環境,
比如yum!!!!!
不要動現有的python2環境!
1、安裝python3.6
1、安裝依賴軟件 yum groupinstall 'Development Tools' -y 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、下載python3軟件包
https://www.python.org/downloads/
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
3、安裝python3
本次裝在/usr/local/python3(具體安裝位置看個人喜好)
mkdir -p /usr/local/python3
4、解壓、編譯
tar -xf Python-3.6.5.tgz
cd Python-3.6.5
./configure --prefix=/usr/local/python3make && make install
5、建立軟連接ln -s /usr/local/python3/bin/python3 /usr/bin/python3
6、並將/usr/local/python3/bin加入PATH
-------------------------------------------------
# vim ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
export PATH
--------------------------------------------------
7、退出是配置生效source ~/.bash_profile
8、檢查Python3及pip3是否正常可用

不行的話在創建一下pip3的軟鏈接(我也不清楚這一步有什么用)
# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
2、 安裝pip以及setuptools
安裝setuptools
畢竟豐富的第三方庫是python的優勢所在,為了更加方便的安裝第三方庫,使用pip命令,我們需要進行相應的安裝。 1、安裝pip前需要前置安裝setuptools wget --no-check-certificate https://files.pythonhosted.org/packages/72/c2/c09362ab29338413ab687b47dab03bab4a792e2bbb727a1eb5e0a88e3b86/setuptools-39.0.1.zip 2、解壓 unzip setuptools-39.0.1.zip 3、編譯 cd setuptools-39.0.1 python3 setup.py build python3 setup.py install
安裝pip
wget --no-check-certificate https://files.pythonhosted.org/packages/e0/69/983a8e47d3dfb51e1463c1e962b2ccd1d74ec4e236e232625e353d830ed2/pip-10.0.0.tar.gz
tar xf pip-10.0.0.tar.gz
cd pip-10.0.0
python3 setup.py build
python3 setup.py install
如果沒有意外的話,pip安裝完成
3、參考博文
1、https://www.cnblogs.com/kimyeee/p/7250560.html
2、https://www.cnblogs.com/feng18/p/5854912.html
3、https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000
4、http://www.runoob.com/python/python-tutorial.html