Linux体系用户正在装置第三圆库的时分,忽然提示谬误代码Python version 2.7 required,which was not found in the registry,逢到那个答题的时分您只需建设一个剧本并执止,便可处理那个答题。
建设一个文件 register.py 内容以下。 而后执止该剧本
代码以下
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 “AV女优 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 “AV女优 Unable to register!”
print “AV女优 You probably have another Python installation!”
if __name__ == “__main__”:
RegisterPy()
下面便是Linux装置第三圆库报错的处理要领了,上文便是该剧本的代码,执止剧本后再装置第三圆库便没有会呈现谬误代码了。
相关文章