Python 截屏

第一次写.

本机Win7 64, Python27(x64) Python33(x64)

今天想试试Python写个截屏,刚看过入门PDF.

代码很简单

from PIL import ImageGrab
import os

im = ImageGrab.grab()
im.save("D:/temp/screenshot.jpg")

os.execvp("mspaint",('mspaint','D:/temp/screenshot.jpg'))

但安装PIL-1.1.7.win32-py2.7.exe时出错啊,找不到python27.

改注册表

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath]
@="C:\\Python27\\"

安装是可以了,但运行时又出现

The _imaging C module is not installed

Bing.com 找到  发现WIN系统的人都会使用网上已经编译好的一个包。而LINUX下回答都很模糊。

Windows 怎么做的不知道啊

image

http://effbot.org/downloads/Imaging-1.1.7.tar.gz 我也下载试试—> 解压—> Python setup.py install 出错,

 

再然后就找到这个了

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

非官方的,不知道之前有多少人知道.我下载安装后解决下,要分享的就是这个(for x64)

posted @ 2012-10-30 14:22  lone112  阅读(803)  评论(0编辑  收藏  举报