RuntimeError: NotImplementedError('Unable to find the Python Python Imaging Library. Please view the SDK documentation for details about installing PIL on your system.',).通过google应用程序引擎日志,我得到了这个错误。我正在试着上传一张图片。我已经安装了PIL,但仍然找不到它的显示。我已经把它安装在
C:\Python27\Lib\site-packages.这是app.yaml
application: uniqueappid
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /static
static_dir: static
- url: /.*
script: main.app
libraries:
- name: jinja2
version: latest
- name: PIL
version: 1.1.7发布于 2017-07-19 03:53:33
如果由于任何原因而无法加载PIL库,则会发生这种情况。我正在运行OSX,所以你的解决方案对你来说可能不同,但也许描述我所做的会对其他人有所帮助。
对我来说,问题是我的Python2.7.13for OSX没有附带yaml库,因此请求图像库失败了。运行此命令可以为我修复此问题:
sudo pip install pyyaml让图像API在本地运行所需的安装总数如下所示:
sudo pip install Pillow pyyaml这些包需要全局安装,因为它们将由API服务器使用。使用-t在本地安装软件包并将库目录添加到appengine_config.py 无法在中工作。
除此之外,我需要在我的app.yaml中将版本修复为1.1.7,尽管您的枕头版本将不会相同:
libraries:
- name: PIL
version: 1.1.7如前所述,您在加载库时遇到的问题可能有所不同,因此我是如何发现缺少的yaml依赖项的:
在下面的最后一行调用栈中,我解释说我的应用引擎库驻留在/Applications/google-cloud-sdk/platform/google_appengine中
File "/Applications/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 259, in _MakeRealSyncCall通过阅读代码,我发现负责检测是否安装了PIL的模块是google.appengine.api.images.images_stub,所以我执行了以下操作:
cd /Applications/google-cloud-sdk/platform/google_appengine/
python -c 'from google.appengine.api.images import images_stub'。。这导致了以下错误:
Traceback (most recent call last):
[... callstack omitted ...]
ImportError: No module named yaml这使我能够确定导入失败是因为缺少yaml模块。
https://stackoverflow.com/questions/22782117
复制相似问题