2010-10-26 46 views
2
* 1. Download the Windows installer from the PIL website. 
* 2. Double click on the installer to start the installation process. 
* 3. Choose the correct directory for PIL install. 
* 4. Finish the installation and test out our sample application locally. 

这些是来自谷歌网站的说明。 但什么是“为PIL安装选择正确的目录”。正确的目录? 是在Python的lib?在谷歌应用程序引擎?或者别的地方?开发服务器中的谷歌应用引擎中的图像问题

我不能让本地与图像的工作:

我的代码:

def upload(input): 

items = input['items'] 

for item in items: 
    img = images.resize(item['image'], 300, 300) 


return img 

我在c安装PIL:\ python的目录,然后我拷入的文件夹我的项目根。仍然没有工作! :■

我得到的错误是:

“d:\托蒂\ web开发\ TottysWorld的\ src \程序\ SERVICES \影像\ upload.py”,第11行,在上传 IMG = images.resize (item ['image'],300,300) ,文件“C:\ GAE \ google \ appengine \ api \ images_ init _.py”,第633行,调整大小 return image.execute_transforms(output_encoding = output_encoding ) ,文件“C:\ GAE \ google \ appengine \ api \ images_ init _.py”,第521行,在execute_transforms 响应中) ,文件“C:\ GAE \ google \ appengine \ api \ apiproxy _Sub_map.py“,第78行,在MakeSyncCall中 返回apiproxy.MakeSyncCall(服务,调用,请求,响应) ,文件”C:\ GAE \ google \ appengine \ api \ apiproxy_stub_map.py“,第278行,在MakeSyncCall中 rpc.CheckSuccess() ,File“C:\ GAE \ google \ appengine \ api \ apiproxy_rpc.py”,第149行,在_WaitImpl self.request,self.response) ,File“C:\ GAE \ google \文件“C:\ GAE \ google \ appengine \ api \ images \ images_stub.py”中的第196行中的MakeSyncCall 方法(请求,响应) 中的第80行“appengine \ api \ apiproxy_stub.py”,第80行,response_value = self._EncodeImage(new_image,request.output()) ,文件“C:\ GAE \ google \ appengine \ api \ images \ images_stub.py”,行227,_EncodeImage image.save(image_string,image_encoding) ,文件“C:\ Python25 \ Lib \ site-packages \ PIL \ Image.py”,行1439,保存为 ,文件“C:\ Python25 \ Lib \ site-packages \ PIL \ PngImagePlugin.py“,第564行,在_save中 ,SystemError:父模块'PIL'未加载

回答

2

PIL必须安装到Python安装路径中。假设您已将Python 2.5安装到C:\ Python,那么PIL的安装路径应该是'C:\ Python \ Lib \ site-packages \'。

当你将它安装到python目录中时,你也不必复制PIL目录到项目根目录。

相关问题