window7下安装第三方包报错及解决
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下安装第三方包报错及解决的更多相关文章
- 解决 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 后,无法 ...
- [python]解决Windows下安装第三方插件报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 0:
系统:win7IDE:pycharm Python版本:2.7 安装第三方插件是报错: 报错原因与编码有关,pip把下载的临时文件存放在了用户临时文件中,这个目录一般是C:\Users\用户名\Ap ...
- 【Python】【亲测好用】安装第三方包报错:AttributeError:'module' object has no attribute 'main'
安装/卸载第三包可能出现如下问题及相应解决办法: 在pycharm编辑中,使用anconda2更新.卸载第三方包时,出现如下错误: AttributeError:'module' object has ...
- PyChram中同目录下import引包报错的解决办法?
相信很多同学和我一样在PyChram工具中新建python项目的同目录下import引包会报错提示找不到,这是因为该项目找不到python的环境导致的: 如果文件开始的时候包引包的错误可以,都可以用用 ...
- Mac下安装第三方模块报错:‘sqlfront.h‘ file not found的解决办法
1.软件环境: mac环境:10.11.6(15G31) python: 3.6 2.问题: sudo pip install pymssql 后出现下面问题: fatal error: 'sqlfr ...
- 解决AttributeError: 'module' object has no attribute 'main' 安装第三方包报错
1.找到pycharm 目录下的 \helper\packaging_tool.py 文件 2.用新版pycharm 的packaging_tool.py 替换 旧版 同名文件 文件代码如下: imp ...
- 解决windows下rstudio安装playwith包报错问题
一.playwith包简介 playwith包提供了一个GTK+图形用户界面(GUI),使得用户可以编辑R图形并与其交互.playwith()函数允许用户识别和标注点.查看一个观测所有的变量值.缩放和 ...
- Linux安装ElasticSearch启动报错的解决方法
Linux安装ElasticSearch后,ElasticSearch是不能用root用户启动的,以root用户启动会报错Refer to the log for complete error det ...
- 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))...,详细报错见下 ...
随机推荐
- jQuery用法小结
jQuery加载1.$(document).ready()2.添加css样式:单个:$("p").css("color","red"); 多 ...
- python使用mysql数据库
一,安装mysql 如果是windows 用户,mysql 的安装非常简单,直接下载安装文件,双击安装文件一步一步进行操作即可. Linux 下的安装可能会更加简单,除了下载安装包进行安装外,一般的l ...
- 【最简单IOC容器实现】实现一个最简单的IOC容器
前面DebugLZQ的两篇博文: 浅谈IOC--说清楚IOC是什么 IoC Container Benchmark - Performance comparison 在浅谈IOC--说清楚IOC是什么 ...
- (四)G1 garbage collector
g1专为大内存,多内核机型设计.可以兼顾高吞吐量和低暂停时间. g1将堆分为多个相同大小内存块,并发的标记线程,使得g1掌握了各个内存块的活对象数量, 内存回收阶段,g1根据用户指定的暂停时间,选择部 ...
- vmstat和iostat
一.vmstat1.命令示例#vmstat 5每5秒输出一次 2.输出详解procs -----------memory---------- ---swap-- -----io---- --syste ...
- ansible 简单使用
前面讲完安装,现在说说怎么用 1.创建目录 mkdir -p /etc/ansible 2. 编辑(或创建)/etc/ansible/hosts 并在其中加入一个或多个远程系统:echo '192.1 ...
- 深入解析PHP中逗号与点号的区别
大部分同学都知道逗号要比点号快,但就是不知道为什么,更不知道逗号与点号这两者之间到底有什么区别.下面小编就来详细的为大家介绍一下,需要的朋友可以过来参考下 echo 'abc'.'def'; //用点 ...
- Raspberry pi 添加vnc远程桌面控制
// 安装服务 apt-get install tightvncserver // 设置连接密码 vncpasswd // 在端口1处开启服务 tightvncserver :1
- LoadRunner函数示例:lr_paramarr_random()
lr_paramarr_random()函数的作用为:从一个参数数组中随机抽取一个值并以字符串形式返回.其使用方式及返回方式如下: char * lr_paramarr_random( const c ...
- Linux从零单排(一):Google Chrome的安装
刚刚安装了Linux ubuntu16.10系统,先装上我一直习惯用的Google Chrome 安装步骤如下: 1.终端输入 sudo wget https://repo.fdzh.org/chro ...