You cannot identify python2.7 in the Registry when installing setuptools.
I found a method on the Internet and only took notes for the next use.
Method:
Create a new register. py file and clickCodePaste in, save (G disk)
## 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 ()
Enter the following command (register. py is stored under the G disk)
Show "Python 2.7 is already registered"
When you install setuptools, You can automatically identify python2.7.
Windows 7 is 64. When installing Python (32-bit), if you select only the current user, the above problems will not occur. If you select all users, use the above method to solve the problem.
Code from: http://tech.valgog.com/2010/01/after-installing-64-bit-windows-7-at.html