Create a new register.py file, paste the code in, Save (G-disk)
650) this.width=650; "src=" Http://common.cnblogs.com/images/copycode.gif "alt=" Copy Code "style=" margin:0px;padding:0px ; border:none; "/>
## 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/[email protected]/msg10512.html import sys from _winreg import * # Tweak as necessaryversion = 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 ()
650) this.width=650; "src=" Http://common.cnblogs.com/images/copycode.gif "alt=" Copy Code "style=" margin:0px;padding:0px ; border:none; "/>
Enter the following command (register.py stored under G-disk)
650) this.width=650; "src=" Http://pic002.cnblogs.com/images/2012/370308/2012052400040771.png "style=" margin:0px; padding:0px;border:0px; "/>
Show "Python 2.7 is already registered"
When you install Setuptools, you can automatically identify the python2.7.
Win7 is 64 reasons, when installing Python (32-bit), if you choose only for the current user, the above problems will not appear, if you choose all users, then use the above method to solve it.
This article is from the "Mr_computer" blog, make sure to keep this source http://caochun.blog.51cto.com/4497308/1539320