在其他版本的mysqldb里面时间查询有问题
最后确定还是在 1.2.5 版本下来解决,需要解决的问题就是这个:
“Cannot open include file: 'config-win.h': No such file or directory” while installing mysql-python

上面是在 1.2.4 版本上的,后来在 1.2.5 上面应该是解决的。但实际上,1.2.5 在Windows 64 位环境下还是有问题的,原因见后面的说明。

安装步骤如下:
1.安装 Microsoft Visual C++ Compiler Package for Python 2.7
下载链接

2.安装 MySQL Connector C 6.0.2
下载链接

3.下载 MySQL-python 1.2.5 源码包
下载链接

4.解压源码包后,修改 site.cfg 文件。
实际上,如果你是在32 位系统上部署,那么通过pip install 安装MySQL-python 1.2.5 只需进行上面的依赖包安装即可。
但在 64 位环境中,就会提示“Cannot open include file: 'config-win.h'” 的错误。
原因就是 site.cfg 中写的 MySQL Connector C 为32 位版本。

原来的 site.cfg 文件内容如下:

引用
# http://stackoverflow.com/questions/1972259/mysql-python-install-problem-using-virtualenv-windows-pip
# Windows connector libs for MySQL. You need a 32-bit connector for your 32-bit Python build.
connector = C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2

修改为:

引用
connector = C:\Program Files\MySQL\MySQL Connector C 6.0.2

5.运行 python setup.py install 即可安装完成。(摘取自http://www.linuxfly.org/windows_install_mysql_python_library/)

我在编译过程中遇到以下问题:

1)问题: _mysql.c(34) : fatal error C1083: Cannot open include file: ‘config-win.h’: No such file or directory
error: command ‘”C:/Program Files/Microsoft Visual Studio 9.0/VC/BIN/cl.exe”‘ failed with exit status 2

原因:原因是安装MySQL的时候没有安装C语言库。

解决:重新运行MySQL的安装程序,选择Modify,把“C Include Files / Lib Files”勾选上,并安装。

2)问题:Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "C:/MySQL-python-1.2.3/setup_windows.py", line 7, in get_config
    serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])
WindowsError: [Error 2] The system cannot find the file specified

原因:MySQL for python 1.2.3仍然是在寻找MySQL5.0的版本

解决:1、打开目录下site.cfg文件,修改最后一行为“registry_key = SOFTWARE/MySQL AB/MySQL Server 5.1”
2、打开setup_windows.py文件,修改第七行为“serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE/MySQL AB/MySQL Server 5.1')”

3)问题:build/temp.win32-2.7/Release/_mysql.pyd.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
error: command ‘mt.exe’ failed with exit status 31

原因:路径发生变化?

解决:打开“你的PYTHON安装目录/Lib/distutils/msvc9compiler.py”文件,找到“ld_args.append(’/MANIFESTFILE:’ + temp_manifest)”这行代码,将其改为“ld_args.append(’/MANIFEST’)”

(4)当编译完成以后,就可以输入setup.py install了,现在终于大功告成了!

可以在DOS环境下输入以下命令进行测试:

C:/Users/Michael>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>>

win64位安装python-mysqldb1.2.5的更多相关文章

  1. win64位安装python-mysqldb1.2.3

    在其他版本的mysqldb里面时间查询有问题最后确定还是在 1.2.5 版本下来解决,需要解决的问题就是这个:“Cannot open include file: 'config-win.h': No ...

  2. win7 32位安装 python 及Numpy、scipy、matplotlib函数包

    操作系统: win7 64位,但选择安装32位的python. 1,python下载安装 https://www.python.org/downloads/ 下载2.7版,一路下一步安装. 并在pat ...

  3. [置顶] 如何在Windows 7 64位安装Python,并使用Matplotlib绘图

    1.     安装Python 我使用的是Windows 7 64 bit,所以我从Python官网下载python-2.7.5.amd64.msi,安装步骤如下: 1)        安装windo ...

  4. window7 64位安装Python

    Python下载地址:https://www.python.org/download/releases/2.7.8/ 选择64位的安装,然后双击打开下载的文件,默认一步步安装. 其中有一个步骤如下图: ...

  5. win7 64 位安装 python,提示: 0x80240017-未指定的错误

    首先确保从python官网下载正确的python版本: https://www.python.org/downloads/windows/ 然后,应该是 VC 相关的问题. 去微软网站下载下列补丁包即 ...

  6. 【转】linux和windows下安装python集成开发环境及其python包

    本系列分为两篇: 1.[转]windows和linux中搭建python集成开发环境IDE 2.[转]linux和windows下安装python集成开发环境及其python包 3.windows和l ...

  7. linux和windows下安装python拓展包及requirement.txt安装类库

    python拓展包安装 直接安装拓展包默认路径: Unix(Linux)默认路径:/usr/local/lib/pythonX.Y/site-packagesWindows默认路径:C:\Python ...

  8. 在win64位,python64位2.7版本中安装pyHook

    今天看了一篇博文说的是利用pyhook监听键盘鼠标事件(感兴趣的可以看博客园中相关文章),文章中使用的pyHook模块的官方下载地址是:http://sourceforge.net/projects/ ...

  9. 怎样在Win7 64位旗舰版安装Python+Eclipse开发环境

    原地址:http://www.cnblogs.com/balian/archive/2011/06/19/2084632.html 自从上周抛弃了WinXP转而安装了Win7,64位后,尝试安装Pyt ...

随机推荐

  1. BSBuDeJie_02

    一 左边的类别数据 1 模型 和 字典中的数据对应 /* id */ @property (nonatomic, assign) NSInteger *id; /* 总数 */ @property ( ...

  2. GIT 操作

    1. 查看某个文件某次提交修改的内容 git show commitid  a.txt  2. git rm 和 git rm --cached  当我们需要删除暂存区或分支上的文件, 同时工作区也不 ...

  3. Final-阶段站立会议6

    组名:天天向上 组长:王森 组员:张政.张金生.林莉.胡丽娜 代码地址:HTTPS:https://git.coding.net/jx8zjs/llk.git SSH:git@git.coding.n ...

  4. Glide加载图片到自定义的圆形ImageView中不显示

    当使用自定义的圆形ImageView时,发现使用Glide加载并设置默认初始图片时,自定义的ImageView一直显示默认图片,无法更新到加载的图片. 使用下面代码可以解决这个问题 Glide.wit ...

  5. 使用Java开发高性能网站需要关注的那些事儿

    无论大型门户网站还是中小型垂直类型网站都会对稳定性.性能和可伸缩性有所追求.大型网站的技术经验分享值得我们去学习和借用,但落实到更具体的实践上并不是对所有网站可以适用,其他语言开发的网站我还不敢多说, ...

  6. 总结-html

    页面尺寸: var w = document.body.scrollWidth; (w + "px")var h = document.body.scrollHeight; (h ...

  7. C++ Windows 下 根据进程名获取进程ID 以及该进程下所有窗口的句柄

    #include <windows.h> #include <stdint.h> #include <tlhelp32.h> #include <stdio. ...

  8. 给HashMap排序,使之成为有序Map

    如何给HashMap中的值排序?这个问题很多人都遇到过,很常见的一个方案是使用LinkedHashMap,因为LinkedHashMap可以记住元素放入的顺序,可以认为是真正的“有序”(想让HashM ...

  9. PDO和消息队列的一点个人理解

    什么是消息队列,百度百科说,···消息队列····是在消息的传输过程中保存消息的容器. 看着网上林林总总的文章,都说是为了应对高并发,处理数据量超级大的一种数据容器,也可以说是利用各种方式,先把数据存 ...

  10. xargs -I

    xargs  -i 参数或者-I参数配合{}即可进行文件的操作.   -I replace-str              Replace  occurrences  of  replace-str ...