Python version 2.7 required, which was not found in the registry.

来源:互联网 发布:文员办公软件 编辑:程序博客网 时间:2024/04/26 13:28

安装numpy-1.6.2-win32-superpack-python2.7

    MySQL-python-1.2.4b4.win32-py2.7

都出现认不出 2.7 的现象  于是乎百度了解决方案

http://www.cnblogs.com/min0208/archive/2012/05/24/2515584.html

方便以后使用

感谢原创者

===============================================================

 

新建一个register.py 文件,把一下代码贴进去,保存(G盘)

 

 

  1. # 
  2. # script to register Python 2.0 or later for use with win32all 
  3. # and other extensions that require Python registry settings 
  4. # 
  5. # written by Joakim Loew for Secret Labs AB / PythonWare 
  6. # 
  7. # source: 
  8. # http://www.pythonware.com/products/works/articles/regpy20.htm 
  9. # 
  10. # modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html 
  11.   
  12. import sys 
  13.   
  14. from _winreg import * 
  15.   
  16. # tweak as necessary 
  17. version = sys.version[:3
  18. installpath = sys.prefix 
  19.   
  20. regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version) 
  21. installkey = "InstallPath" 
  22. pythonkey = "PythonPath" 
  23. pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % ( 
  24.     installpath, installpath, installpath 
  25.   
  26. def RegisterPy(): 
  27.     try
  28.         reg = OpenKey(HKEY_CURRENT_USER, regpath) 
  29.     except EnvironmentError as e: 
  30.         try
  31.             reg = CreateKey(HKEY_CURRENT_USER, regpath) 
  32.             SetValue(reg, installkey, REG_SZ, installpath) 
  33.             SetValue(reg, pythonkey, REG_SZ, pythonpath) 
  34.             CloseKey(reg) 
  35.         except
  36.             print "*** Unable to register!" 
  37.             return 
  38.         print "--- Python", version, "is now registered!" 
  39.         return 
  40.     if (QueryValue(reg, installkey) == installpath and 
  41.         QueryValue(reg, pythonkey) == pythonpath): 
  42.         CloseKey(reg) 
  43.         print "=== Python", version, "is already registered!" 
  44.         return 
  45.     CloseKey(reg) 
  46.     print "*** Unable to register!" 
  47.     print "*** You probably have another Python installation!" 
  48.   
  49. if __name__ == "__main__"
  50.     RegisterPy() 

然后 python运行它

0 0