安装PIL遇到的问题


解决方案:

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

是因为安装的Python是64位,PIL却是32位,而官方发布的只有32位,找个非官方的64位安装。

原因:
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遇到的问题的更多相关文章
- 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的一些依赖库还没 ...
- Mac下安装 PIL
最近入手MacBook Pro 在配置PIL环境的时候遇到一些问题.现在把解决方式记录下来,希望对有需要的有所帮助. 1. 安装brew : brew 又叫Homebrew,是Mac OSX上的软件 ...
- 安装PIL库时提示python未注册错误(自定义python安装路径)
import sys from _winreg import * # tweak as necessary version = sys.version[:3] installpath = sys.pr ...
- 64位Python安装PIL
写个小程序需要安装PIL,但是官网只有32位,无法找到64位安装路径.根据网上教程自行编译,但是由于VS版本问题总是提示“Python error: Unable to find vcvarsall. ...
- Mac系统下安装PIL
安装PIL依赖JPEG.Freetype.LittleCMS, 首先安装这三个环境(第一至三步): 第一步:安装JPEG http://www.ijg.org/files/jpegsrc.v8c.ta ...
- ubuntu Python2.7 安装PIL问题
$sudo easy_install PIL WARNING: '' not a valid package name; please use only.-separated package name ...
- 关于python下安装PIL库遇到的问题及解决办法
关于python下安装PIL库遇到的问题及解决办法 关于python下安装PIL库遇到的问题及解决办法 :在下面这个网址下载pipllow(a replacement for PIL) www.lfd ...
- [转]安装PIL时注册表中找不到python2.7
如果在win7x64安装python2.7的时候选择了all user,则安装PIL的时候会显示找不到python. 解决办法:复制下面的代码到一个.py文件并运行: # # script to re ...
- ubuntu14.04 安装PIL库出现OError: decoder jpeg not available 的解决方案
出现 OError: decoder jpeg not available 的原因是,没有装JPEG的库,同时要支持png图片的话还要装 ZLIB.FREETYPE2.LITTLECMS的库文件. 先 ...
随机推荐
- CentOS 安装及配置Salt api
安装 # yum -y install salt-api 更改配置 vim /etc/salt/master 把默认的注释掉 我们这边默认配置文件目录是/srv/salt default_inclu ...
- Js根据class名替换html标签内容 ,在某标签前后添加内容
function getClass(obj, attr) { var aArray = [];//定义一个新的空数组 var i = 0; var aAll = document.getElement ...
- C#生成随机汉字
using System; using System.Text; namespace ConsoleApplication { class ChineseCode { ...
- CDONTS组件
在ASP中发送Email时往往需要一个COM组件支持,如果你没有第三方的Email组件,你可以使用IIS本身提供CDONTS EMail组件.这个组件使用时需要安装和启动SMTP服务.这个组件的名称为 ...
- java基础增强
Eclipse使用: java Compile配置的是java编译环境 java Build path配置的是java运行环境 运行环境的版本必须高于编译环境的版本.否则报错 工程上 右键--prop ...
- cddiv/数组维护
题目连接 看代码: #include <set> #include <map> #include <cmath> #include <queue> #i ...
- mysql中的substr()函数
mysql中的substr()函数和hibernate的substr()参数都一样,就是含义有所不同. 用法: substr(string string,num start,num length); ...
- 在win7/8/10鼠标右键添加“管理员取得所有权”
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\Shell\TakeAuthority]"icon"=" ...
- Android接收wifi路由器发送过来的一组字节数据
1.字节数组转换为字符串 byte[] byBuffer = new byte[20];... ...String strRead = new String(byBuffer);strRead = S ...
- 转:WebDriver进行屏幕截图
例: 打开百度首页 ,进行截图 01 packagecom.example.tests; 02 importjava.io.File; 03 importorg.apache.commons.io ...