安装django 提示ImportError: No module named setuptools

安装django前要先安装setuptools
先安装一些必要的包,否则会报错:Python build finished, but the necessary bits to build these modules were not found
#yum install -y sqlite bzip2-devel.i686 gdbm-devel.i686 readline-devel.x86_64 readline-devel sqlite-devel openssl-devel.i686 libdbi-devel.i686 ncurses-libs zlib-devel.i686 openssl-devel bzip2-devel gdbm-devel libdbi-devel zlib-devel
 
还有错误的话下载zlib安装(安装包见附件)
# wget http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz
# tar zxvf zlib-1.2.8.tar.gz
# cd zlib-1.2.8
# ./configure
# make install
 
参考:http://www.tuicool.com/articles/FjmA3u
 
 
#wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz --no-check-certificate
#tar zxvf setuptools-0.6c11.tar.gz
#cd setuptools-0.6c11
#python setup.py build
#python setup.py install
 
如果在install时提示Compression requires the (missing) zlib module
回到python解压后的目录中,记得先安装zlib,再启动zlib模块,操作如下
 
#cd /root/Python-2.7.8
#vi Modules/Setup.dist
搜索zlib,去掉 #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz 前面的注释。
 
#cd /root/Python-2.7.8/Modules/zlib
#./configure && make && make install
然后回到/root/Python-2.7.8目录下
#./configure --enable-shared --prefix=/usr/local/python27
#make
#make install
 
 
ps:安装完上述模块后,django只需要解压,然后执行#python setup.py install 即可
参考:http://farlee.info/archives/centos5-python-mod_wsgi-django-install-osqa.html
 
附件:
https://app.yinxiang.com/shard/s41/res/d480a890-adba-452c-a3a0-3fa30037c1b3/zlib-1.2.8.tar.gz
posted @ 2015-01-19 11:27  BiboXie  阅读(633)  评论(0编辑  收藏  举报