window7 64位下安装第三方包,,比如安装yaml的exe执行文件,会

报错及解决:python version 2.7(3.4) required,which was not found in the registry

方法:新建一个register.py 文件,把一下代码贴进去,保存

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

用python2.7的idle执行一下即可,会提示“python 2.7 is already registered”

window7 下安装的是python3.4的32位,没有_winreg模块导致无法按脚本,可直接在注册表中直接添加

LOCAL_CURRENT_USER\software\python\PyhtonCore下创建3.4目录,添加InstallPath和PythonPath项,具体如下图:

InstallPath:   D:\python\Python34

PythonPath:  D:\python\Python34;D:\python\Python34\Lib\;D:\python\Python34\DLLs\

window7下安装第三方包报错及解决的更多相关文章

  1. 解决 mac 10.14.4 无法 sublime text 3207 安装 Package Control,以及安装第三方包报错 `Package Control There are no packages available for installation`

    下载最新的 sublime text 3207,无法安装 Package Control. 根据官方提示,手动安装 Package Control. 手动安装 Package Control 后,无法 ...

  2. [python]解决Windows下安装第三方插件报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 0:

    系统:win7IDE:pycharm Python版本:2.7 安装第三方插件是报错:  报错原因与编码有关,pip把下载的临时文件存放在了用户临时文件中,这个目录一般是C:\Users\用户名\Ap ...

  3. 【Python】【亲测好用】安装第三方包报错:AttributeError:'module' object has no attribute 'main'

    安装/卸载第三包可能出现如下问题及相应解决办法: 在pycharm编辑中,使用anconda2更新.卸载第三方包时,出现如下错误: AttributeError:'module' object has ...

  4. PyChram中同目录下import引包报错的解决办法?

    相信很多同学和我一样在PyChram工具中新建python项目的同目录下import引包会报错提示找不到,这是因为该项目找不到python的环境导致的: 如果文件开始的时候包引包的错误可以,都可以用用 ...

  5. Mac下安装第三方模块报错:‘sqlfront.h‘ file not found的解决办法

    1.软件环境: mac环境:10.11.6(15G31) python: 3.6 2.问题: sudo pip install pymssql 后出现下面问题: fatal error: 'sqlfr ...

  6. 解决AttributeError: 'module' object has no attribute 'main' 安装第三方包报错

    1.找到pycharm 目录下的 \helper\packaging_tool.py 文件 2.用新版pycharm 的packaging_tool.py 替换 旧版 同名文件 文件代码如下: imp ...

  7. 解决windows下rstudio安装playwith包报错问题

    一.playwith包简介 playwith包提供了一个GTK+图形用户界面(GUI),使得用户可以编辑R图形并与其交互.playwith()函数允许用户识别和标注点.查看一个观测所有的变量值.缩放和 ...

  8. Linux安装ElasticSearch启动报错的解决方法

    Linux安装ElasticSearch后,ElasticSearch是不能用root用户启动的,以root用户启动会报错Refer to the log for complete error det ...

  9. pip安装第三方库报错Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...

    pip安装第三方库时报错Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...,详细报错见下 ...

随机推荐

  1. 第九周 psp

    团队项目PSP 一:表格     C类型 C内容 S开始时间 E结束时间 I时间间隔 T净时间(mins) 预计花费时间(mins) 讨论 讨论用户界面 9:50 12:45 35 45 80 分析与 ...

  2. C语言

    HTML的学习早已落下帷幕,我们已经进入了C语言的学习,这段时间时间主要学了运算符.表达式.循环语句以及数组和字符串,感觉到了一种朦朦胧胧懂得尴尬. 运算符主要包括:算术运算符.赋值运算符.关系运算符 ...

  3. 1.线性表-Array

    fatal.h #include <stdio.h> #include <stdlib.h> #define Error( Str ) FatalError( Str ) #d ...

  4. springmvc HandlerInterceptoer WebRequestInterceptor MethodInterceptor使用

    HandlerInterceptoer拦截的是请求地址,所以针对请求地址做一些验证.预处理等操作比较合适.

  5. 掌握Thinkphp3.2.0----CURD

    TP-----CURD  create()创建数据----整理数据 在数据库添加等操作之前,我们首先需要对数据进行创建.何为数据创建,就是接受提交过来的数据,比如表单提交的 POST(默认)数据.接受 ...

  6. 20145220&20145209&20145309信息安全系统设计基础实验报告(4)

    20145220&20145209&20145309信息安全系统设计基础实验报告(4) 实验报告链接: http://www.cnblogs.com/zym0728/p/6132246 ...

  7. Hire Me, Microsoft China

    为微软中国工作是一个愿望.对于其他的股票期权,令人难以置信的小吃店或很酷的工作室,引诱他们的可能性.很多人都想为微软中国工作,谁知道,也许你就是其中之一.这个博客是专门为在微软中国工作.做它的工作空缺 ...

  8. JavaScript作用域和闭包

    在JavaScript中,作用域是执行代码的上下文.作用域有3种类型: 1.全局作用域 2.局部作用域---(又叫函数作用域) 3.eval作用域 var foo =0;//全局作用域console. ...

  9. java web filter 学习(2)

    本文主要对filter的基本使用进行了讲解,其中涉及到了 filter是什么 一个filter处理一个jsp 多个filter处理一个jsp filter是什么 Filter 是java下的一种过滤器 ...

  10. 基于Python的TestAgent实现

    问题: 1.本人工作主要做自动化,经常要去Linux后台进行一些脚本操作,有时要去后台执行命令,如果逐个登陆比较费事,效率会大打折扣 2.虽然有可以直接去后台执行命令的AW,但是该AW存在很多问题,而 ...