python2.5 virtualenv中的MySQLdb [英] MySQLdb within python2.5 virtualenv

查看:37
本文介绍了python2.5 virtualenv中的MySQLdb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 MySQL 服务器的 Fedora 11 机器.Fedora 11 内部使用python 2.6,并且python 2.6 自动安装在盒子上.我为 2.5.5 版创建了一个 python virtual-env,以便我可以运行 turbogears 1.x 应用程序.我在盒子上安装了 MySQLdb rpm(它在 python 2.6 上运行良好).

I have a Fedora 11 box with MySQL server. Fedora 11 uses python 2.6 internally and python 2.6 is automatically installed on the box. I have created a python virtual-env for version 2.5.5, so that I can run turbogears 1.x application. I have MySQLdb rpm installed on the box (and it works fine with python 2.6).

当我从 python 2.6 版中导入 MySQLdb 时,它导入成功.当我从 python 2.5.5 virtual-env 中导入 MySQLdb 时,导入失败(因为我已经安装了带有 --no-site-packages 的 virtual-env).所以,我必须将 MySQLdb python 安装为本地包(本地到 virtual-env).

When I import MySQLdb from within python version 2.6 it imports is successfully. When I import MySQLdb from within the python 2.5.5 virtual-env the import fails (because I have installed virtual-env with --no-site-packages). So, I have to install MySQLdb python as a local package (local to virtual-env).

虚拟环境中的easy_install MySQL-python"失败.它下载 MySQL-python-1.2.3.c1.tar.gz/download,但python setup.py build"失败并出现错误.在 virtual-env 之外构建 MySQL 也会出现同样的问题.

'easy_install MySQL-python' within the virtual env fails. It downloads the MySQL-python-1.2.3.c1.tar.gz/download, but the 'python setup.py build' fails with error. The same problem occurs when building the MySQL outside of virtual-env.

MySQL-python 的python setup.py build"是否试图链接到一个库(我是否缺少一些库)?或者下载的代码是否缺少一些头文件(不太可能)?

Is the 'python setup.py build' for MySQL-python trying to link to a library (and am I missing some library)? Or is the downloaded code missing some header files (unlikely)?

谢谢.

S.马克,

如果我要安装 MySQL 头文件,它们会与现有的 rpms 混淆吗?

If I were to install MySQL header files, would they mess with the existing rpms?

[抱歉,多余.本质上,MySQL 在机器上是有效的,MySQL-python 对 python 2.6 有效,但 MySQL-python 在 python 2.5.5 的 virtualenv 中无效.]

[Sorry, for being redundant. In essence, MySQL is functional on the machine, MySQL-python is functional for python 2.6, but MySQL-python is not functional from virtualenv for python 2.5.5.]

感谢您的帮助.

# rpm -qa | grep -i mysql
MySQL-python-1.2.3-0.4.c1.fc11.x86_64  
perl-DBD-MySQL-4.010-1.fc11.x86_64  
mysql-libs-5.1.42-7.fc11.x86_64  
mysql-5.1.42-7.fc11.x86_64  
php-mysql-5.2.12-1.fc11.x86_64  
mysql-server-5.1.42-7.fc11.x86_64

推荐答案

_mysql.c:36:23: error: my_config.h: No such file or directory
_mysql.c:38:19: error: mysql.h: No such file or directory
_mysql.c:39:26: error: mysqld_error.h: No such file or directory
_mysql.c:40:20: error: errmsg.h: No such file or directory

请安装 MySQL 头文件,可能在这里

Please install MySQL header files, probably here

这篇关于python2.5 virtualenv中的MySQLdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆