zoukankan      html  css  js  c++  java
  • win64位安装python-mysqldb1.2.3

    在其他版本的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
    下载链接

    大意是说找不到注册表,网上搜索解决方案。

    新建一个register.py文件写入代码:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    import sys
      
    from _winreg import *
      
    # tweak as necessary
    version = sys.version[:3]
    installpath = sys.prefix
      
    regpath = "SOFTWARE\Python\Pythoncore\%s\" % (version)
    installkey = "InstallPath"
    pythonkey = "PythonPath"
    pythonpath = "%s;%s\Lib\;%s\DLLs\" % (
        installpath, installpath, installpath
    )
      
    def RegisterPy():
        try:
            reg = OpenKey(HKEY_CURRENT_USER, regpath)
        except EnvironmentError as e:
            try:
                reg = CreateKey(HKEY_CURRENT_USER, regpath)
                SetValue(reg, installkey, REG_SZ, installpath)
                SetValue(reg, pythonkey, REG_SZ, pythonpath)
                CloseKey(reg)
            except:
                print "*** Unable to register!"
                return
            print "--- Python", version, "is now registered!"
            return
        if (QueryValue(reg, installkey) == installpath and
            QueryValue(reg, pythonkey) == pythonpath):
            CloseKey(reg)
            print "=== Python", version, "is already registered!"
            return
        CloseKey(reg)
        print "*** Unable to register!"
        print "*** You probably have another Python installation!"

    启动命令切到register.py文件目录下执行

    重新安装PIL,错误解决,安装成功。

    如果是win7 64位的用户在安装Python 32位程序时,如果选择只为当前用户,以上问题不会出现。如果选择所有用户,就试着使用以上方法解决。

    提示其它版本解决方法类似。

  • 相关阅读:
    0401-服务注册与发现、Eureka简介
    001-OSI七层模型,TCP/IP五层模型
    云原生应用开发12-Factors
    0301-服务提供者与服务消费者
    0201-开始使用Spring Cloud实战微服务准备工作
    0107-将Monolith重构为微服务
    0106-选择微服务部署策略
    0105-微服务的事件驱动的数据管理
    0104-微服务体系结构中的服务发现
    0103-微服务架构中的进程间通信
  • 原文地址:https://www.cnblogs.com/mabingxue/p/8886866.html
Copyright © 2011-2022 走看看