国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python version 2.7 required,which was not found in the registry

2019-11-08 03:11:57
字體:
供稿:網(wǎng)友

安裝PIL-1.1.7.win32-py2.7或者pywin32的時候,不能再注冊表中識別出來python2.7

 方法:新建一個register.py 文件,把一下代碼貼進(jìn)去,保存

## 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 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()

按F5執(zhí)行即顯示:

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32Type "copyright", "credits" or "license()" for more information.>>> ================= RESTART: C:/Users/jila/Desktop/register.py ==================== Python 2.7 is already registered!>>> 

顯示“python 2.7 is already registered”

再安裝setuptools 或者 pywin32的時候,就能自動識別出來python2.7了。

Win7是 64的原因,在安裝python(32位)時,如果選擇只為當(dāng)前用戶,以上問題是不會出現(xiàn)的,如果選擇所有用戶,那就用上面的方法解決吧。


上一篇:python 照片文件名分類

下一篇:python安裝

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 沈阳市| 阿巴嘎旗| 石林| 碌曲县| 新闻| 达州市| 肇源县| 体育| 格尔木市| 鲁山县| 松潘县| 松原市| 永吉县| 锡林郭勒盟| 巴彦淖尔市| 敖汉旗| 阜阳市| 汾阳市| 安吉县| 大足县| 梅河口市| 滦南县| 江安县| 余江县| 芦山县| 江西省| 平乡县| 兴宁市| 敖汉旗| 金川县| 大冶市| 尼勒克县| 泰州市| 义乌市| 赞皇县| 左贡县| 当涂县| 楚雄市| 阜城县| 交口县| 博客|