[root@linuxprobe ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
[root@linuxprobe ~]# cd /usr/local/src [root@linuxprobe src]# wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz # 若提示錯誤 請加上這個參數"--no-check-certificate"能夠下載
[root@linuxprobe src]# mkdir /usr/local/python3.5 [root@linuxprobe src]# tar -zxvf Python-3.5.2.tgz [root@linuxprobe src]# cd Python-3.5.2 [root@linuxprobe src]# ./configure --prefix=/usr/local/python3.5 [root@linuxprobe src]# make && make install [root@linuxprobe src]# ln -s /usr/local/python3.5/bin/python3 /usr/bin/python3
[root@linuxprobe ~]# vim ~/.bash_profile PATH=$PATH:$HOME/bin:/usr/local/python3.5/bin #添加python命令的路徑 [root@linuxprobe ~]# source ~/.bash_profile
能夠經過官方模塊庫來下載:https://pypi.python.org/pypi
[root@linuxprobe src]# wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz [root@linuxprobe src]# tar zxvf setuptools-19.6.tar.gz [root@linuxprobe src]# cd setuptools-19.6.tar.gz [root@linuxprobe src]# python3 setup.py build [root@linuxprobe src]# python3 setup.py install [root@linuxprobe src]# wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz [root@linuxprobe src]# tar zxvf pip-8.0.2.tar.gz [root@linuxprobe src]# cd pip-8.0.2 [root@linuxprobe src]# python3 setup.py build [root@linuxprobe src]# python3 setup.py install [root@linuxprobe src]# ln -s /usr/local/python3.5/bin/pip /usr/bin/pip [root@linuxprobe src]# pip --version #安裝成功 pip 8.0.2 from /usr/local/python3.5/lib/python3.5/site-packages/pip-8.0.2-py3.5.egg (python 3.5)
[root@linuxprobe src]# vi /usr/bin/yum
#!/usr/bin/python 改成 #!/usr/bin/python2.7
站在巨人的肩膀上看世界https://www.jianshu.com/p/2aeba5899c4chttps://blog.csdn.net/zuolovefu/article/details/78142507