Python dev\u appserver无法导入`.so`文件(枕头)

2024-09-29 17:23:26 发布

您现在位置:Python中文网/ 问答频道 /正文

在我的GAE应用程序中,我尝试以下方法:

from PIL import Image

得到这个:

Traceback (most recent call last):
  ...
  File "/home/sheena/Workspace/Waxed/code/waxed_backend/src/waxed_backend/concerns/misc/views.py", line 57, in home
    from PIL import Image
  File "libs/PIL/Image.py", line 56, in <module>
    from . import _imaging as core
  File "/home/sheena/Workspace/Waxed/venvs/wxt_comp/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 1024, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named PIL._imaging

/path/to/libs/PIL/imaging.so存在。我从dev\u appserver中导入libs文件中的任何内容都没有问题。你知道吗

这很管用:

cd /path/to/libs/
python
>>> from PIL import Image

我只能得出这样的结论:要么是dev\u appserver以某种方式破坏了importrt功能,使得.so文件无法识别。你知道吗

以前有人见过这个吗?你知道怎么修吗?你知道吗


Tags: infrompyimageimporthomepilgoogle
1条回答
网友
1楼 · 发布于 2024-09-29 17:23:26

\u imaging是一个用C编写的PIL依赖项。因为它是C而不是Python,包含lib文件夹中的库将不起作用。你需要在你的附录yaml文件:

libraries:
   - name: PIL
     version: latest

相关问题 更多 >

    热门问题