一定要先安装
http://blog.csdn.net/yabingshi_tech/article/details/50439142
yum install openssl -yyum install openssl-devel -ypython3
http://www.cnblogs.com/wenchengxiaopenyou/p/5709218.html
cd Python-3.5.2
./configure --prefix=/opt/Python #安装目录可以自己定义无所谓。makemake install做软连接
# ln -s /opt/Python/bin/python3 /usr/bin/python3
修改yum python2.6
vi /usr/bin/yum
将第一行的#!/usr/bin/python修改为系统原有的python版本地址#!/usr/bin/python2.6,
至此CentOS6.3系统Python已成功升级至2.7.6版本。 安装 SETUPTOOLSwget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26tar -zxvf setuptools-19.6.tar.gz
cd setuptools-19.6.tar.gz
python3 setup.py build
python3 setup.py install
安装 pip
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eebtar -zxvf pip-8.0.2.tar.gz
cd pip-8.0.2
python3 setup.py build
python3 setup.py install
安装完成之后我们再来看下python的bin目录下都有什么东西吧
[root@centos3 bin]# /opt/Python/bin/pip3 install pymysqlCollecting pymysql Downloading PyMySQL-0.7.5-py2.py3-none-any.whl (77kB) 100% |████████████████████████████████| 81kB 3.2kB/s Installing collected packages: pymysqlSuccessfully installed pymysql-0.7.5######安装完成
[root@centos3 bin]# python3
Python 3.5.2 (default, Jul 27 2016, 03:36:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import pymysql>>>安装ipython3 python3 -m pip install ipython ln -s /usr/local/Python3/bin/ipython3 /usr/bin/ipython3