Unable to find the Python PIL library.Google App E

2019-04-20 18:23发布

Installed the Google App Engine SDK.Python 2.6 perfect. Wanted to go into images, and test locally.Installed PIL

Installed Python, then ran the PIL install, worked this time.

Things seemed good, but trying to do localhost image manipulation gives:

"NotImplementedError: Unable to find the Python PIL library.  Please
 view the SDK documentation for details about installing PIL on your system."

System : winxp

7条回答
该账号已被封号
2楼-- · 2019-04-20 18:41

If you clear your GAE log window (assuming you're using the launcher) then restart your server, you might see something in the log. In my case I got

    WARNING  2011-01-27 21:04:11,856 dev_appserver.py:3698] 
Could not initialize images API; you are likely missing the Python "PIL" module. 
ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
  Referenced from: /Library/Python/2.6/site-packages/PIL/_imaging.so

So I could tell that I didn't link well enough with the JPEG library.

查看更多
Deceive 欺骗
3楼-- · 2019-04-20 18:49

We're probably going to need more information, so here are some questions and things to try.

How are you trying to access the PIL? Are you trying to use the google.appengine.api.images module, or PIL directly? It sounds like the former, but it's not clear.

Did you follow the App Engine instructions?

Post code, if you can.

Perhaps the most important thing to try: see if you can use PIL from a non-App Engine script. Just write a quick Python script that accesses it and see how that goes. Something like:

import Image
im = Image.open('filename.png')
im.show()

If that doesn't work, it's not surprising that Google App Engine wouldn't work with PIL.

查看更多
欢心
4楼-- · 2019-04-20 18:57

I've run into the same issue on Windows machine and then I've notice in the App Engine Docs:

Note: In addition to the Images API, you can also use the transforms provided in the Python Imaging Library (PIL) in your Python 2.7 app. You simply declare the library in the libraries section of the app.yaml file. However, if you wish to use PIL in your local environment (using the development server) you must also download and install PIL or pillow locally.

So just download PIL and it will work.

查看更多
ら.Afraid
5楼-- · 2019-04-20 19:00

I took a while to get PIL working. Mainly because I forgot to tell app engine to load it in the yaml file:

 libraries:
     - name:    PIL
     version: 1.1.7

Maybe this step is obvious, but I did not see it documented well on google documentation and I found all kinds of messages here stating that PIL was not available on app engine. I want to confirm that PIL is running on app engine.

查看更多
Bombasti
6楼-- · 2019-04-20 19:02

For OSX 10.11.6 and Python 2.7.13 I needed to install pyyaml in addition to Pillow globally in order for the launched API server to pick them up:

sudo pip install Pillow pyyaml

After this I had to specifically add the PIL version 1.1.7 into the app.yaml libraries, even though the Pillow version was NOT 1.1.7:

libraries:
- name: PIL
  version: 1.1.7

The way I found that I was missing the yaml library is described in more detail in this comment:

PIL cannot be found

查看更多
Bombasti
7楼-- · 2019-04-20 19:04

As far as I know Google AppEngine does not allow to use PIL directly, but instead provides a limited Images API.

It can resize/rotate/crop and flip images. More or less what Picasaweb can do. But it cannot create new images or do complex things like adding text, drawing etc.

查看更多
登录 后发表回答