python环境搭建(已废弃)

1. 环境准备
centos:
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers sqlite-devel libaio libaio-devel

ubuntu:

sudo apt-get install autoconf 
sudo apt-get install curl
sudo apt-get install libmysqld-dev
sudo apt-get install libaio-dev #安装mysql需要
sudo apt-get install libjpeg62-dev
sudo apt-get install libpng12-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install libssl-dev
sudo apt-get install zlib1g-dev

下面两个lib经测试也需要安装,否则会出现错误:http://blog.donews.com/maverick/archive/2007/04/16/1156473.aspx

sudo apt-get install libmysqld-dev
sudo apt-get install  python-dev

2. 安装module
wget http://dev.duitang.com/setup/packages/setuptools-0.6c11.tar.gz
python setup.py install

报错:
RuntimeError: Compression requires the (missing) zlib module


3. pythone使用pypi来管理他的package,安装pip
http://dev.duitang.com/setup/packages/pip-1.0.2.tar.gz
python setup.py install
pip install --no-index -f  http://dev.duitang.com/setup/packages/   -r  http://dev.duitang.com/setup/requirement.txt

4.启动
python manage.py runserver

-----------------------------------------------------------
后记
编译python提示需要的库,记录一下,以下都不是必须的:
Tkinter: Tkinter是一个python模块,是一个调用Tcl/Tk的接口,它是一个跨平台的脚本图形界面接口。Tkinter不是唯一的python图形编程接口,但是是其中比较流行的一个。最大的特点是跨平台,缺点是性能不太好,执行速度慢。
Curses:Linux终端图形库Curses
bsddb185 是一个很古老的 Oracle Berkeley DB 的模块;
imageop 也是 32 位系统上的过时模块,被 PIL 代替
ossaudiodev   没用
linuxaudiodev 没用
SQLite 一个小型关系数据库
------------------------------------------------------
问题:

64位ubuntu 始终会报告这个错误,没有解决:

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _curses            _curses_panel  
_tkinter           bsddb185           bz2            
dbm                dl                 gdbm           
imageop            linuxaudiodev      ossaudiodev    
readline           sunaudiodev                       
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

sudo apt-get install sqlite3 libsqlite3-tcl libsqlite3-dev
sudo apt-get install  python-bsddb3
sudo apt-get install python-tk

  File "/home/yunpeng/python/lib/python2.7/zipfile.py", line 679, in __init__
    "Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module

你可能感兴趣的:(python)