1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
我的博客已迁移到xdoujiang.com请去那边和我交流
基础环境说明及安装
当前系统
cat
/etc/debian_version
5.0.1
因自带的python版本太旧 开发需要使用python2.7的版本
并需要paramiko Crypto MySQLdb threadpool这些模块
一、安装python2.7
1、下载到指定目录
cd
/opt
wget http:
//www
.python.org
/ftp/python/2
.7.3
/Python-2
.7.3.
tar
.bz2 --no-check-certificate
2、需要安装的包
apt-get -y
install
bzip2
--force-
yes
apt-get -y
install
libc6-dev --force-
yes
apt-get -y
install
make
--force-
yes
apt-get -y
install
libssl-dev --force-
yes
apt-get -y
install
zlib1g-dev --force-
yes
apt-get -y
install
libmysqlclient15-dev
3、解压并编译安装
tar
-jxvf Python-2.7.3.
tar
.bz2 -C
/opt
cd
Python-2.7.3
.
/configure
make
make
install
4、测试看下
python2.7
Python 2.7.3 (default, Feb 11 2014, 11:38:11)
[GCC 4.3.2] on linux2
Type
"help"
,
"copyright"
,
"credits"
or
"license"
for
more
information.
>>>
到此python2.7安装完成
二、安装模块
1、下载easy_install-2.7
wget --no-check-certificate http:
//pypi
.python.org
/packages/2
.7
/s/setuptools/setuptools-0
.6c11-py2.7.egg
#md5=fe1f997bc722265116870bc7919059ea
2、安装easy_install-2.7
sh setuptools-0.6c11-py2.7.egg
3、安装pip工具
easy_install-2.7 pip
4、先使用pip命令查询下所需要安装的包
pip search
"MySQL-python"
MySQL-python - Python interface to MySQL
pip search
"threadpool"
threadpool - Easy to use object-oriented thread pool framework
pip search
"paramiko"
paramiko - SSH2 protocol library
5、安装
pip
install
paramiko
pip
install
MySQL-python
pip
install
threadpool
6、查看已安装的包
pip list
ecdsa (0.13)
MySQL-python (1.2.5)
paramiko (1.15.2)
pip (7.0.1)
pycrypto (2.6.1)
setuptools (0.6rc11)
threadpool (1.2.7)
7、测试
python2.7
Python 2.7.3 (default, May 31 2015, 23:54:34)
[GCC 4.3.2] on linux2
Type
"help"
,
"copyright"
,
"credits"
or
"license"
for
more
information.
>>>
import
paramiko
>>>
import
Crypto
>>>
import
MySQLdb
>>>
import
threadpool
安装都OK了
|
本文转自 xdoujiang 51CTO博客,原文链接:http://blog.51cto.com/7938217/1657106,如需转载请自行联系原作者