centos7 打造基于python语言Selenium2自动化开发环境
1. 准备
安装模块
# yum groupinstall "Development tools"
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
# Python 2.7.6:
# wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
# tar xf Python-2.7.6.tar.xz
# cd Python-2.7.6
# ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
#make && make altinstall(此处切记,要么以root运行,要么分开执行!)
# Python 3.3.5:
# wget http://python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
# tar xf Python-3.3.5.tar.xz
# cd Python-3.3.5
# ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
# make && make altinstall(此处切记,要么以root运行,要么分开执行!)
下载和安装Setuptools + pip
Setuptools 早已取代 Distribute 成为Python官方的拓展包管理器,以用于从Python Package Index安装拓展功能包。 不同版本的Python需要的Setuptools版本不同。建议您也通过Setuptools安装 pip,它提供了一些额外在安装拓展功能包时很有用的功能。
以下的命令可用于安装最新版Setuptools 和 pip
# First get the setup script for Setuptools:
wgethttps://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
# Then install it for Python 2.7 and/or Python 3.3:
python2.7ez_setup.py
python3.3ez_setup.py
# Now install pip using the newly installed setuptools:
easy_install-2.7pip
easy_install-3.3pip
# With pip installed you can now do things like this:
pip2.7install[packagename]
pip2.7install--upgrade[packagename]
pip2.7uninstall[packagename]
安装的拓展功能包在
/usr/local/lib/pythonX.Y/site-packages/
中可以找到(X.Y
是Python的版本号)。