1、升级完Python ,报No module named yum Please install a package which provides this module, or。。。。这个错误
解决方法:
# vi /usr/bin/yum
#!/usr/bin/python2.6 改成老版本的python
2、安装python辅助工具 setuptools报错,报File "/usr/local/python2.7.12/lib/python2.7/zipfile.py", line 736, in __init__
"Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module。。。。这个错误
"Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module。。。。这个错误
解决方法: 出现这个问题的原因是由于安装Python的时候没有进行依赖包的检查。所有首先,安装zlib
$wget http://zlib.net/zlib-1.2.8.tar.gz
$tar -xvzf zlib-1.2.8.tar.gz
$cd zlib-1.2.8.tar.gz
$./configure
$make
$sudo make install
$tar -xvzf zlib-1.2.8.tar.gz
$cd zlib-1.2.8.tar.gz
$./configure
$make
$sudo make install
安装完成以后,重新安装Python
cd Python-2.7.12
./configure --prefix=/usr/local/python2.7.12
make && make install
./configure --prefix=/usr/local/python2.7.12
make && make install
再次安装setuptools,运行sudo python setup.py install
结果如下:
copying setuptools.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/setuptools-1.4.2-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing setuptools-1.4.2-py2.7.egg
Copying setuptools-1.4.2-py2.7.egg to /usr/local/python2.7.12/lib/python2.7/site-packages
Adding setuptools 1.4.2 to easy-install.pth file
Installing easy_install script to /usr/local/python2.7.12/bin
Installing easy_install-2.7 script to /usr/local/python2.7.12/bin
Installed /usr/local/python2.7.12/lib/python2.7/site-packages/setuptools-1.4.2-py2.7.egg
Processing dependencies for setuptools==1.4.2
Finished processing dependencies for setuptools==1.4.2
[root@bogon setuptools-1.4.2]#
creating 'dist/setuptools-1.4.2-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing setuptools-1.4.2-py2.7.egg
Copying setuptools-1.4.2-py2.7.egg to /usr/local/python2.7.12/lib/python2.7/site-packages
Adding setuptools 1.4.2 to easy-install.pth file
Installing easy_install script to /usr/local/python2.7.12/bin
Installing easy_install-2.7 script to /usr/local/python2.7.12/bin
Installed /usr/local/python2.7.12/lib/python2.7/site-packages/setuptools-1.4.2-py2.7.egg
Processing dependencies for setuptools==1.4.2
Finished processing dependencies for setuptools==1.4.2
[root@bogon setuptools-1.4.2]#
错误信息消失,安装成功