cygwin中安装MySQL Python module

前面比较简单,直接按图索骥
1、安装cygwin
2、下载mysql包编译安装client端:
tar -xvzf mysql-5.0.37.tar.gz
cd mysql-5.0.37
配置、编译、安 装
./configure --without-server
make && make install

3、编译安装MySQLdb
tar -xvzf MySQL-python-1.2.2.tar.gz
cd MySQL-python-1.2.2

首先修改MySQLdb的编译配置文件:site.cfg,在MySQL-python-1.2.2目录下。

找到[options]项进行如下修改:

放开mysql_config = /usr/local/bin/mysql_config一行,屏蔽#registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0一行,因为cygwin属于类Linux不是Windows。

由于我们用在PC机上所以设置embedded为False。

设置threadsafe为False;我们尽量采用静态编译,static设为True。

最后的[options]如下:

[code]

[options]
# embedded: link against the embedded server library
# threadsafe: use the threadsafe client
# static: link against a static library (probably required for embedded)
embedded = False
threadsafe = False
static = True
# The path to mysql_config.
# Only use this if mysql_config is not on your PATH, or you have some weird
# setup that requires it.<
mysql_config = /usr/local/bin/mysql_config
# The Windows registry key for MySQL.
# This has to be set for Windows builds to work.
# Only change this if you have a different version.
#registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0

[/code]



cd MySQL-python-1.2.2
python setup.py build
python setup.py install
在安装过程中可能会要求下载setuptools,按要求下载即可。

安装完成在python测试运行的时候遇到问题,死活说没有权限,

报ImportError: Permission denied错误

查询相关资料发现,是cygwin下需要修改用户目录下的那个cache的_mysql.dll权限

路径如下:

/home/用户名/.python-eggs/MySQL_python-1.2.2-py2.5-cygwin-1.5.25-i686.eg
g-tmp/_mysql.dll

chmod +x _mysql.dll 后再次执行。ok ,pass


参考文章:
http://blog.csdn.net/kernelspirit/archive/2007/04/18/1568884.aspx
http://www.velocityreviews.com/forums/t484678-python-eggs-on-cygwin.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值