基础环境说明及安装 当前系统 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了
时间: 2024-10-18 05:45:03