“无法打开包含文件:‘config-win.h’:没有这样的文件或目录"在安装 mysql-python 时 [英] "Cannot open include file: 'config-win.h': No such file or directory" while installing mysql-python

查看:19
本文介绍了“无法打开包含文件:‘config-win.h’:没有这样的文件或目录"在安装 mysql-python 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows 上使用 pip 在 vi​​rtualenv 中安装 mysql-python.起初,我遇到了同样的错误此处报告,但那里的答案也对我有用.现在我收到以下错误:

I'm trying to install mysql-python in a virtualenv using pip on windows. At first, I was getting the same error reported here, but the answer there worked for me too. Now I'm getting this following error:

_mysql.c(34) : Fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory

如果我将 (Win7) 符号链接到我的常规(不是 virtualenv 的)python 的 site-packages/MySQLdb 目录,我会得到

If I symlink (Win7) to my regular (not the virtualenv's) python's site-packages/MySQLdb dir I get

Error loading MySQLdb module: No module named _mysql

我在这里有点不知所措.有什么指点吗?

I'm rather at a loss here. Any pointers?

推荐答案

更新 mysql 5.5 和 config-win.h 不可见问题

Update for mysql 5.5 and config-win.h not visible issue

在 5.5 config-win 中.实际上已移至 Windows 中的连接器单独文件夹.即喜欢:

In 5.5 config-win. has actually moved to Connector separate folder in windows. i.e. smth like:

C:Program FilesMySQLConnector C 6.0.2include

C:Program FilesMySQLConnector C 6.0.2include

要克服这个问题,不仅需要下载dev bits"(实际上连接connector),还需要修改mysqldb 安装脚本以添加包含文件夹.我已经做了一个快速的肮脏修复.

To overcome the problem one need not only to download "dev bits" (which actually connects the connector) but also to modify mysqldb install scripts to add the include folder. I've done a quick dirty fix as that.

site.cfg:

# Windows connector libs for MySQL.
connector = C:Program FilesMySQLConnector C 6.0.2

在 setup_windows.py 中找到该行

in setup_windows.py locate the line

include_dirs = [ os.path.join(mysql_root, r'include') ]:

并添加:

include_dirs = [ os.path.join(options['connector'], r'include') ]

之后.

丑陋,但在 mysqldb 作者改变行为之前一直有效.

Ugly but works until mysqldb authors will change the behaviour.

差点忘了说.以同样的方式需要为库添加类似的附加条目:

Almost forgot to mention. In the same manner one needs to add similar additional entry for libs:

library_dirs = [ os.path.join(options['connector'], r'libopt') ]

即你的 setup_windows.py 看起来很像:

i.e. your setup_windows.py looks pretty much like:

...
library_dirs = [ os.path.join(mysql_root, r'libopt') ]
library_dirs = [ os.path.join(options['connector'], r'libopt') ]
libraries = [ 'kernel32', 'advapi32', 'wsock32', client ]
include_dirs = [ os.path.join(mysql_root, r'include') ]
include_dirs = [ os.path.join(options['connector'], r'include') ]
extra_compile_args = [ '/Zl' ]
...

这篇关于“无法打开包含文件:‘config-win.h’:没有这样的文件或目录"在安装 mysql-python 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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