将python加入到注册表中:
#
# 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()
版权声明:本文为博主原创文章,未经博主允许不得转载。
分享到:
相关推荐
安装PIL库的时候,直接提示:Python version 2.7 required, which was not found in the registry。 如图: 大意是说找不到注册表,网上搜索解决方案。 新建一个register.py文件写入代码: 复制代码 代码如下: ...
成功解决安装pywin32时出现python version 3.6 required, which was not found in the registry 目录 解决问题 解决方法 第一步,打开注册编辑器:regedit 第二步,如图所示,定位到python 第三步,把注册表中文件夹...
32/64位windows,python2.7用的MySQL-python 解决安装MySQL-python出现的:Python version 2.7 required, which was not found in the registry
安装pycrypto-2.6.win32py2.7.exe时会报“Python version 2.7 required, which was not found in the registry ”时请按照:http://www.cnblogs.com/min0208/archive/2012/05/24/2515584.html上操作即可。...
解决Python version 2.7 required, which was not found in the registry 内有安装scrapy win64位安装教程及所有安装插件,成功安装 1.python-2.7.8.amd64.msi 2.pywin32-219.win-amd64-py2.7.exe 3.zope.interface-...
2、安装时会出现以下错误:Python version 2.7 required, which was not found in the registry。 解决办法: (1)新建一个register.py文件,把以下代码粘贴进去,保存到D盘。 # script to register Python 2.0 or ...
解决安装PyWin32问题:Python version x.x required, which was not found in the registry.
windows安装python mysqldb时报错python version 2.7 required,which was not found in the registry 网上很多方案,比如方案一: Python3.x时, from _winreg import * 改为 from winreg import * 去掉下划线 ...
windows下python第三方库安装不成功时,修改注册表脚本,一般会提示类似如下“python2.7 is required,which is not found in registry”
资源分类:Python库 所属语言:Python 资源全名:winregistry-1.1.0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
从网站下载,完成后双击安装,但提示Python version -32 required, which was not found in the registry. 从网上搜索到以下解决方案: 新建文件D:\register.py,通过脚本建立注册信息 #===============register....
Notable changes in Python 3.6.5 What’s New In Python 3.5 Summary – Release highlights New Features PEP 492 - Coroutines with async and await syntax PEP 465 - A dedicated infix operator for matrix...
安装Mysql-python时报错Adding Python Information to the Windows Registry 需要使用register.py cmd python register.py
Driver Information in the Registry
in the demo mode, or the value 1, when the driver has found a valid key, and therefore is licenced. This function is also available via the OPC server interface. The same item-ID address format has...
7.9 Examining the Microsoft Windows Registry for a List of Name Server Addresses 7.10 Getting Information About the Current User on Windows NT/2000 7.11 Getting the Windows Service Name from ...
VC++6.0中ActiveX控件注册表项,用于在Windows系统中注册ActiveX控件。 使用方法:将Windows Registry Editor Version 5.00文件复制到C:\WINDOWS\system32路径下即可。
Structuring of Services in the Registry .
6: Add to registry EPLAN 2.7 1-2.reg and EPLAN 2.7 2-2.reg 7: Start a command console with administrator rights and run install.cmd that you can find in MultiKey64. If you don't want to use the ...