python的easy_install工具非常棒,安装和卸载组件非常方便,安装过程如下:
wget -q http:
//peak
.telecommunity.com
/dist/ez_setup
.py
执行上面的命令把ez_setup.py文件下载到当前的目录下
执行:
python ez_setup.py
下载对应的setuptools-xx.egg文件,没想到出现以下错误:
zipimport.ZipImportError: can’t decompress data; zlib not available
解决办法:
(1)先安装系统相应的依赖库文件
sudo
apt-get
install
zlibc zlib1g-dev
(2)到python安装目录下执行
sudo ./configure
编辑Modules/Setup文件
vim Modules/Setup
找到下面这句,去掉注释
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
重新编译安装:
sudo
make
sudo
make
-i
install
(3)重新执行
python ez_setup.py
现在就可以用 sudo easy_install 命令安装其他组件了
但是在实际过程中,提示需要先执行下面的命令,那就按提示操作执行:
sudo apt-get -f install
sudo apt-get install zlibc zlib1g-dev
root@az-aacdb01:/opt# chmod +x ez_setup.py
root@az-aacdb01:/opt# python ez_setup.py
Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
Traceback (most recent call last):
File "ez_setup.py", line 278, in <module>
main(sys.argv[1:])
File "ez_setup.py", line 210, in main
egg = download_setuptools(version, delay=0)
File "ez_setup.py", line 158, in download_setuptools
src = urllib2.urlopen(url)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 469, in error
result = self._call_chain(*args)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 656, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 454, in _open
'unknown_open', req)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 1265, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: https>
dpkg命令是Debian Linux系统用来安装、创建和管理软件包的实用工具
-i:安装软件包;
-r:删除软件包;
-P:删除软件包的同时删除其配置文件;
-L:显示于软件包关联的文件;
-l:显示已安装软件包列表;
--unpack:解开软件包;
-c:显示软件包内文件列表;
--confiugre:配置软件包。
实例:查看hive的可安装软件包
root@az-aacdb01:/usr/local# dpkg -l | grep hive
ii cpio 2.11-7ubuntu3.1 GNU cpio -- a program to manage archives offiles
ii ubuntu-keyring 2011.11.21.1 GnuPG keys of the Ubuntuarchive