今天在安装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. PL/SQL将sql脚本数据导入Oracle

    PL/SQL将sql脚本数据导入数据库: 1.首先,使用plsql登录到需要导入数据的数据库.在[tools]--[Import tables] 2.选择第二个[SQL Inserts],在下面,点击 ...

  2. 关于HTTP_USER_AGENT

    其实HTTP_USER_AGENT的内容获取的很详细 可以获取手机的型号 这个是我的手机用UC浏览器 访问获取的代码 Mozilla/5.0 (Linux; U; Android 7.1.1; zh- ...

  3. 13.纯 CSS 创作一个冒着热气的咖啡杯

    原文地址:https://segmentfault.com/a/1190000014734039 感想:伪元素::before ::after 真的很强大,动画也是. HTML代码: <div ...

  4. mapPartitions

    mapPartitions操作与 map类似,只不过映射的参数由RDD中的每一个元素变成了RDD中每一个分区的迭代器,如果映射过程需要频繁创建额外的对象,使用mapPartitions操作要比map操 ...

  5. PHPutf-8转码。

    $str = 'jiaoqing.': echo mb_convert_encoding($str,"gbk","utf-8");

  6. python第三方库自动安装脚本

    #python第三方库自动安装脚本,需要在cmd中运行此脚本#BatchInstall.pyimport oslibs = {"numpy","matplotlib&qu ...

  7. django之manytomanyfield

    #mezzanine中BlogPost类的定义class BlogPost(Displayable, Ownable, RichText, AdminThumbMixin): "" ...

  8. ECharts 的用法

    1. ECharts的获得 官网: https://echarts.baidu.com/ 你可以通过以下几种方式获取 ECharts. 从官网下载界面选择你需要的版本下载,根据开发者功能和体积上的需求 ...

  9. Spring Cloud(2)A Eureka server端 服务注册建立

    1. 父项目pom <dependency> <groupId>org.springframework.cloud</groupId> <artifactId ...

  10. delphi RTTI 三 属性读取与赋值

    delphi RTTI 读取属性 运行期 通过RTTI给属性赋值 http://docwiki.embarcadero.com/CodeExamples/Berlin/en/Event_RTTI_In ...