Linux下面安装Python常见错误解决方法

来源:互联网 发布:影楼软件下载第一站 编辑:程序博客网 时间:2024/06/15 22:42

1、升级Python导致yum无法使用,报错No module named yum Please install a package which provides this module, or。。。。

解决方式

# vi /usr/bin/yum
#!/usr/bin/python2.6    改成老版本的python

2、安装setuptools报错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

然后再次安装Python

cd Python-2.7.12
./configure --prefix=/usr/local/python2.7.12
make && make install

再次安装setuptools,不再报错,如下所示


copying setuptools.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
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]# 

0 0
原创粉丝点击