zoukankan      html  css  js  c++  java
  • webpy 开发环境搭建问题之Mysql-python安装

      关于python核心编程已经看了差不多,准备搞些框架方面的学习,本来想打算看看Django的,但是朋友推荐先看看轻量级的flask或者webpy的开发,所以晚上回来,搭建下开发环境(PS:搭建过程中由于网上参考资料难免多多少少会出点问题。)

      在搭建webpy开发环境的过程中遇到安装mysql出错,提示为

    Python version 2.7 required, which was not found in the registry

      不过通过万能的互联网还是找到了解决方法:

      本人在e盘根目录下创建一个register.py文件,在其中贴入如下代码:

      #
    # script to register Python 2.0 or later for use with win32all
    # and other extensions that require Python registry settings
    #
    # written by Joakim Loew for Secret Labs AB / PythonWare
    #
    # source:
    # http://www.pythonware.com/products/works/articles/regpy20.htm
    #
    # modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html
     
    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!"
     
    if __name__ == "__main__":
        RegisterPy()

      最后在cmd命令行执行这段代码后,重新安装mysql就可以找打注册信息以及python的安装路径了。

  • 相关阅读:
    Jenkins与Hudson的关系
    Jenkins企业版与CloudBees
    NSLookup命令
    XCopy提示“访问遭到拒绝”问题解决
    npm配置文件
    npm下载包时代理配置
    Jenkins实现测试环境到生产环境一键部署(Windows)
    可能是迄今为止最好的GitHub代码浏览插件--赞
    Ali OSS服务端签名直传并设置上传回调
    导入https证书
  • 原文地址:https://www.cnblogs.com/kirago/p/4138592.html
Copyright © 2011-2022 走看看