Python2.7.13 安装
说明
以下所有操作都基于centos6.9
1. Issue
zlib zlib-devel是安装setuptools依赖的模块,需要在安装python之前先安装这两个模块
2. Install Base
#基础依赖
yum -y install gcc gcc-c++ zlib zlib-devel openssl-devel
#删除当前mysql版本
yum remove MySQL-server-5.6.21-1.el6.x86_64 MySQL-client-5.6.21-1.el6.x86_64 MySQL-devel-5.6.21-1.el6.x86_64
#重新安装mysql-dev
yum -y install mysql-devel.x86_64
3. Install python2.7.13.tar.gz
cd /ddhome/usr/python2.7.13
./configure
make && make install
which python
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python /usr/bin/python
4. Install setuptools-33.1.1.zip
(pip 安装需要用到setuptools模块)
cd /ddhome/usr/setuptools-33.1.1
python setup.py install
5. Install pip-9.0.1.tar.gz
cd /ddhome/usr/pip-9.0.1
python setup.py install
5.1 ssl
开启ssl模块,要不然pip安装https请求的所有模块都会失败,而且必须在make之前完成
先配置python,即先运行 ./configure, 会出现./Module/Setup文件
vim Module/Setup, 修改如下
# Socket module helper for socket(2)
_socket socketmodule.c timemodule.c
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
_ssl _ssl.c
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl
-L$(SSL)/lib -lssl -lcrypto
6 python的图形编程接口, 使用matplotlib做图时需要
# centos
yum install -y tkinter tk-devel
# ubuntu
sudo apt-get install python-tk
7. Install pandas numpy matplotlib seaborn scipy hdfs pyinotify
python mysql lib: MySQL-python PyMySQL
MySQL-python 停止更新,不支持python3
PyMYSQL 支持python3
pip install matplotlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install numpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install seaborn scipy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install hdfs MySQL-python interval
8.pyecharts相关依赖包
pip install pyecharts
# Geo Data extensions
pip install echarts-cities-pypkg
# Map extensions
pip install echarts-countries-pypkg
pip install echarts-china-provinces-pypkg
pip install echarts-china-cities-pypkg
pip install echarts-china-counties-pypkg
pip install echarts-china-misc-pypkg
pip install echarts-united-kingdom-pypkg