今天在安装pygame时出错,提示“Python version 2.7 required, which was not found in the registry”,经过网上查找资料后发现只需要新建一个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()
 
    保存文件,命名为register.py,然后将该文件放到python的安装路径下,默认地址为:C:\Python27
然后重新双击pygame的安装包进行安装即可。
 
 
 
                                                发布日期:2014-01-24 15:22

安装 pygame,找不到Python version 2.7的更多相关文章

  1. 安装第三方模块时遇到Python version 2.7 required, which was not found

    ## script to register Python 2.0 or later for use with win32all# and other extensions that require P ...

  2. Python 安装Twisted 提示python version 2.7 required,which was not found in the registry

    由于我安装Python64位的,下载后没注册,安装Twisted时老提示“python version 2.7 required,which was not found in the registry ...

  3. 【亲测】Python:解决方案:Python Version 2.7 required, which was not found in the registry

    好久不更新随笔了,今天因为数据可视化作业,想抓取一些人人网好友关系数据,于是开始尝试python,用到numpy模块,安装的时候提示: 'Python Version 2.7 required, wh ...

  4. python - 在Windows系统中安装Pygame及导入Eclipse

    环境:python3.6(只有一个版本)+ windows10(64 bit)  + Eclipse+pydev python3.6安装完成后,会自带 easy_install 和 pip3,在Win ...

  5. 解决python语言的工具pycharm以及Windows电脑安装pygame模块的问题

    人生苦短,我用python,python作为一门当今时代潮流性的语言,已经成为大多数的年轻程序猿们向往的目标,python中有许多的库, 其中有一个pygame库是作为开发2D游戏必不可少的开发库,是 ...

  6. 安装 pywin32-218.win32-py2.7.exe 报错python version 2.7 required,which was not found in the registry解决方案

    随便在一个盘下 新建register.py的文件,内容如下: #   # script to register Python 2.0 or later for use with win32all    ...

  7. 【转】安装第三方库出现 Python version 2.7 required, which was not found in the registry

    安装第三方库出现 Python version 2.7 required, which was not found in the registry 建立一个文件 register.py 内容如下. 然 ...

  8. 安装第三方库出现 Python version 2.7 required, which was not found in the registry

    安装第三方库出现 Python version 2.7 required, which was not found in the registry 建立一个文件 register.py 内容如下. 然 ...

  9. 96、python version 3.6 required,which was not fount in the registry(python3.6安装scrapy)

    在安装scrapy时遇到问题 环境:win10(64位), Python3.6(64位) 安装scrapy: 1.安装wheel(安装后,便支持通过wheel文件安装软件) pip3 install ...

随机推荐

  1. ios-复制字符串到剪贴板

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.string = self.label.text;

  2. java-代码生成器

    package ormRex; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import ...

  3. IntelliJ IDEA tomcat 热部署

    1.点击idea中tomcat设置 2.点击Deployment查看Deploy at the server startup 中tomcat运行的包是 xxxx:war 还是其他,如果是xxx:war ...

  4. 33.纯 CSS 创作牛奶文字变换效果

    原文地址:https://segmentfault.com/a/1190000015037234 感想:transform: translateY(50% & -50%);  animatio ...

  5. 看到的一个关于C++能力分级的描述

    精通没有标准,但学习有路径. 我来说说 学习掌握C++的路径吧,从低到高,分0-10级: 0级:掌握常见C++语法和语言构造,能够顺溜地写清楚各种语言构造(很多小白鼠死在这里)1级:掌握基本的编程范式 ...

  6. APP-5-百度电子围栏

    1.代码部分 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <me ...

  7. list集合转换成datatable

    /// 将list集合转换成datatable /// </summary> /// <param name="list"></param> / ...

  8. xcode 自动签名、手动签名

    手动签名:需要手动生成p12文件(私钥),然后将对应的公钥上传到开发者网站,生成证书,进一步生成对应的描述文件,然后在xcode中手动指定描述文件,这个描述文件中包含与本地p12文件对应的证书. 自动 ...

  9. Java IO流学习总结六:ByteArrayInputStream、ByteArrayOutputStream

    类的继承关系 InputStream |__ ByteArrayInputStream OutputStream |__ ByteArrayOutputStream ByteArrayInputStr ...

  10. java split函数结尾空字符串被丢弃的问题

    参考: http://yinny.iteye.com/blog/1750210 http://www.xuebuyuan.com/1692988.html java中的split函数用于将字符串分割为 ...