日期:2014-05-16 浏览次数:20441 次
最近实习要求非root用户安装各种环境,特此记下日记
wget python和mysqldb的源码包
Python : http://www.python.org/getit/
MySQLdb: http://sourceforge.net/projects/mysql-python/
tar -zxvf Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=your_python_dir(你准备安装的路径)
make && make install
tar -zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
# your_python_dir/bin/python2.7 setup.py build
# your_python_dir/bin/python2.7 setup.py install
tar -zxvf MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
vim site.cfg 修改mysql路径
去掉mysql_config前边的‘#’修改mysql_config的路径
(例:mysql_config = /home/$USER/local/mysql/bin/mysql_config)
# your_python_dir/bin/python2.7 setup.py build
# your_python_dir/bin/python2.7 setup.py install
# your_python_dir/bin/python2.7
import MySQLdb 如果不出现异常则安装成功