1 ImportSYS2 3 from_winregImport*4 5 #tweak as necessary6Version = Sys.version[:3]7InstallPath =Sys.prefix8Regpath ="software\python\pythoncore\%s\\"%(version)9Installkey ="InstallPath"TenPythonkey ="PythonPath" OnePythonpath ="%s;%s\lib\;%s\dlls\\"% ( A InstallPath, InstallPath, InstallPath - ) - the defRegisterpy (): - Try: -Reg =Openkey (HKEY_CURRENT_USER, Regpath) - exceptEnvironmentError as E: + Try: -Reg =CreateKey (HKEY_CURRENT_USER, Regpath) + SetValue (Reg, Installkey, REG_SZ, InstallPath) A SetValue (Reg, Pythonkey, REG_SZ, Pythonpath) at Closekey (REG) - except: - Print "* * * Unable to register!" - return - Print "---Python", version,"is now registered!" - return in if(QueryValue (Reg, installkey) = = InstallPath and -QueryValue (Reg, pythonkey) = =Pythonpath): to Closekey (REG) + Print "= = = Python", version,"is already registered!" - return the Closekey (REG) * Print "* * * Unable to register!" $ Print "* * * You probably has another Python installation!"Panax NotoginsengRegisterpy ()
Run the above code and register the existing path to install PIL.
pil:http://pythonware.com/products/pil/
Prompt python for unregistered errors when installing the PIL library (custom python installation path)