安装python32时提示注册表中没有python 3.5,如何在注册表中添加python 3.5

T5278910T 2015-08-26 02:43:23
如题:
以下是我安装pywin32时的错误提示信息

我想问下怎么把python3.5加入注册表呢?

...全文
3351 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
Orchidblessing 2019-08-06
  • 打赏
  • 举报
回复
我只想说,你们这些大佬太牛x了
阿凯99 2016-11-22
  • 打赏
  • 举报
回复
安一个就够用了。windows是一个脏的操作系统,特别扯蛋的就是注册表。
sych888 2016-11-08
  • 打赏
  • 举报
回复
zghgchao 2016-11-07
  • 打赏
  • 举报
回复
完美解决
gongxingsheng 2016-08-31
  • 打赏
  • 举报
回复
楼上的脚本是Python 2.*版本,在Python下3.5执行报错,简单修改了一下。 # # 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()
student-ai 2016-08-31
  • 打赏
  • 举报
回复
学习了。。。。。我一般只安装一个,
天堂的鸽子 2016-08-15
  • 打赏
  • 举报
回复
网上找个注册脚本执行一项就ok了。 附上:
#
# 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
 
'''
解决注册问题,pywin32安装存在问题
'''

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()
xqlily 2016-08-15
  • 打赏
  • 举报
回复
我今天安装的是pywin 2.7的版本,开始下载的是64位的pywin,安装后出现和楼主一样的错误,说python2.7在注册中未找到,然后重新安装了python2.7,下载pywin 32位的版本,再次安装就成功了。楼主的问题我认为可以重新安装一下python3.5,然后看看您安装的32位的还是64位的Python版本,选择下载pywin对应的版本再试一次吧,一般来说安装python后,注册表里面会有它的注册信息,看是否是您安装的pywin的版本不对,这里的python 32位或64位不是指您操作系统是32位还是64位的,而是指python的安装版本,下载地址:https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/。
小津 2016-01-01
  • 打赏
  • 举报
回复
问下楼主问题解决了吗?我也出现了这个问题。

我想是不是因为我同时先后安装了py2.7和3.5,安装2.7的pywin32就可以,但安装3.5的就找不到。

我的环境变量里只有py3.5的,没有2.7的。

感觉很奇怪。
T5278910T 2015-08-26
  • 打赏
  • 举报
回复
千万别沉下去哇。。。。

37,744

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧