配置:Win7 64位
不过折腾到最后,没有使用PIL,官方的PIL很久木有更新了,换了Pillow,是PIL的衍生吧,一直有更新,但是两者不可在同一环境共存。
1 Python version 2.7 required,which was not found in the registry.
官方下载http://www.pythonware.com/products/pil/,安装PIL,出现如下错误提示,Python version 2.7 required,which was not found in the registry.

解决方案:

 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()
将如上文件执行,进行注册,之后再尝试安装,成功。
 
2 DLL load failed:%1不是有效的Win32应用程序
但是之后在使用_imaging模块时又报错:
DLL load failed:%1不是有效的Win32应用程序
是因为安装的Python是64位,PIL却是32位,而官方发布的只有32位,找个非官方的64位安装。
 
3 如何卸载目前安装的PIL
在PIL安装路径下看到RemovePIL.exe文件,执行失败,提示:This program is normally started by Windoows。
在该路径中可看到PIL-wininst.log,里面有记录卸载的命令,根据提示执行卸载命令即可。

 

原因:

python有64位的,pil官方只有32位的。安装时会提示找不到python的安装路径。

64位Win7下无法安装PIL库的原因

PIL官方http://www.pythonware.com/products/pil/提供的PIL二进制安装库都是32位的。

64位程序和32位程序检测注册表的位置是不一样的:

64-bit: HKEY_LOCAL_MACHINESOFTWAREPython

32-bit: HKEY_LOCAL_MACHINESOFTWAREWow6432NodePython

我安装的是Python2.7 x64版,所以相关信息是在 HKEY_LOCAL_MACHINESOFTWAREPython下面,32位程序在HKEY_LOCAL_MACHINESOFTWAREWow6432NodePython 下面找Python安装信息,肯定是找不到了。

解决:

幸好有人提供了非官方的64位库(官方源码编译版)。

http://www.lfd.uci.edu/~gohlke/pythonlibs/

安装PIL遇到的问题的更多相关文章

  1. Mac osx 安装PIL出现Some externally hosted files were ignored (use --allow-external PIL to allow).

    出现这个问题Some externally hosted files were ignored (use --allow-external PIL to allow)的主要原因是PIL的一些依赖库还没 ...

  2. Mac下安装 PIL

     最近入手MacBook Pro 在配置PIL环境的时候遇到一些问题.现在把解决方式记录下来,希望对有需要的有所帮助. 1. 安装brew : brew 又叫Homebrew,是Mac OSX上的软件 ...

  3. 安装PIL库时提示python未注册错误(自定义python安装路径)

    import sys from _winreg import * # tweak as necessary version = sys.version[:3] installpath = sys.pr ...

  4. 64位Python安装PIL

    写个小程序需要安装PIL,但是官网只有32位,无法找到64位安装路径.根据网上教程自行编译,但是由于VS版本问题总是提示“Python error: Unable to find vcvarsall. ...

  5. Mac系统下安装PIL

    安装PIL依赖JPEG.Freetype.LittleCMS, 首先安装这三个环境(第一至三步): 第一步:安装JPEG http://www.ijg.org/files/jpegsrc.v8c.ta ...

  6. ubuntu Python2.7 安装PIL问题

    $sudo easy_install PIL WARNING: '' not a valid package name; please use only.-separated package name ...

  7. 关于python下安装PIL库遇到的问题及解决办法

    关于python下安装PIL库遇到的问题及解决办法 关于python下安装PIL库遇到的问题及解决办法 :在下面这个网址下载pipllow(a replacement for PIL) www.lfd ...

  8. [转]安装PIL时注册表中找不到python2.7

    如果在win7x64安装python2.7的时候选择了all user,则安装PIL的时候会显示找不到python. 解决办法:复制下面的代码到一个.py文件并运行: # # script to re ...

  9. ubuntu14.04 安装PIL库出现OError: decoder jpeg not available 的解决方案

    出现 OError: decoder jpeg not available 的原因是,没有装JPEG的库,同时要支持png图片的话还要装 ZLIB.FREETYPE2.LITTLECMS的库文件. 先 ...

随机推荐

  1. include和 merge

    include和merge标记的作用主要是为了解决layout的重用问题. 比如我们有三四个Activity但是他们都要用到同一个样式的标题栏,虽然我们把一样的代码copy个三四遍也没关系,但实在是太 ...

  2. ClickOnce发布注意的一些细节

    细节1.应用程序启动前检查更新: 步骤:主工程-右键属性-发布(页面)-按“更新”按钮-勾选“应用程序应该检查更新(T)”-选择“应用程序启动前(F)”,如下图: 细节二:ClickOnce发布时&q ...

  3. 转 Oracle 12c 使用scott等普通用户的方法

    一.前言 最近电脑上安装了oracle 12c数据库,想体验下新特性.安装完后,便像11g一样在dos窗口进行下面的操作: SQL*Plus: Release 12.1.0.2.0 Productio ...

  4. CGRect相关工具函数

    NSStringFromCGRect(aCGRect): CGRectFromString(aString):如果把视图的框架以字符串的形式放在NSUserDefaults里面,那么该方法可以将其转回 ...

  5. php 个推的例子

    个推   http://docs.getui.com/server/php/start/ <?php /** * Created by PhpStorm. * User: xiaochao * ...

  6. fzu Problem - 2232 炉石传说(二分匹配)

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=2232 Description GG学长虽然并不打炉石传说,但是由于题面需要他便学会了打炉石传说.但是传统的炉石 ...

  7. 转:Loadrunner报错“Too many local variablesAction.c”解决方法

    问题描述,在Action.c里定义数组时如果数组长度过长,如char a[1024*1024]运行时即会报错: 问题原因及解决方法如下: 1. VuGen对于局部变量可以分配的最大内存为64K,如果想 ...

  8. Activity not started, its current task has been brought to the front的解决办法

    删除bin目录下所有文件,重新启动在试试

  9. MySQL5.1升级5.6后,执行grant出错:ERROR 2013 (HY000): Lost connection to MySQL server during query【转载】

    转载: MySQL5.5升级5.6后,执行grant出错:ERROR 2013 (HY000): Lost connection to -mysql教程-数据库-壹聚教程网http://www.111 ...

  10. laravel 报错 mcrypt_decrypt(): Key of size 11 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported

    修改app/config/app.php文件 将key设置成长度为16,24,32的字符串