配置: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. C++11 半同步半异步线程池的实现

    #include <list> #include <mutex> #include <thread> #include <condition_variable ...

  2. c++ map unordered_map

    map operator<的重载一定要定义成const.因为map内部实现时调用operator<的函数好像是const. #include<string> #include& ...

  3. 【jsp】读取WebRoot下的图像文件

    package readPic; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream ...

  4. Servlet与jsp间的传值问题

    Servlet与JSP 之间的传值有两种情况:JSP -> Servlet, Servlet -> JSP.通过对象 request和 session (不考虑 application)完 ...

  5. eclipse 配置scala问题-More than one scala library found in the build path

    配置eclipse出错解决 山重水复疑无路,柳暗花明又一村!经过大量的验证...终于make it. 参考博客:http://blog.csdn.net/wankunde/article/detail ...

  6. 多校 Cow Bowling

    题目链接:http://acm.hust.edu.cn/vjudge/contest/124435#problem/I 密码:acm Sample Input Sample Output 分析: #i ...

  7. GoF 设计模式:浅浅印象

    23种设计模式,常常多个模式结合使用,主要是为了解决中大型软件项目"类和对象"膨胀的问题,进而有效组织类的结构而提出的.可划分为3类:创建型(关于类的创建),结构型(多个类的组织) ...

  8. 转:Selenium2.0之grid学习总结

    (一)介绍: Grid的功能: 并行执行 通过一个中央管理器统一控制用例在不同环境.不同浏览器下运行 灵活添加变动测试机 (二)快速开始 这个例子将介绍如何使用selenium2.0的grid,并且注 ...

  9. android 5.0新特性学习--视图阴影

    android 5.0的视图阴影主要是体验出层次性,就是在一个物体上面叠加上一层的设计,而这种设计就是除了传统的,x,y的纸面层,还有就是透过纸面的z轴的层次设计. elevation: 高度,静态属 ...

  10. 我终于有案例库啦(github 提供的)

    穷逼一个,一直在纠结要不要买个服务器什么的. 后来在慕课网看 git 教程时看到 github 可以帮你展示网页哟,于是我便有了这个案例库. 网址:https://foreverz133.github ...