我试图使用PIL在Python中定义IBM函数。
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
img = Image.new('RGB', (width, height))
d = ImageDraw.Draw(img)
...我使用Pycharm进行我的开发。在Pycharm中,在我的Python运行时的site-packages下,我看到了PIL和Pillow-4.3.0:dist-info。当我在Pycharm内部本地运行我的代码时,它工作得很好。
我使用相同的Python运行时和我的代码构建了一个virtualenv,以便包含不属于云端函数的依赖关系。通过查看virtualenv,我可以看到相同的库:
\virtualenv
\bin
\include
\lib
\python3.6
\site-packages
...
\PIL
\Pillow-4.3.0:dist-info
...但是,当我在这个virtualenv运行时以云函数的形式执行代码时,我会看到一个错误:ModuleNotFoundError: No module named 'PIL'。
我认为错误在于我如何构造我的virtualenv,但我感到困惑,因为它看起来是相同的库在那里。
发布于 2017-10-30 16:35:40
好吧,我解决了眼前的问题。这是我的部署脚本中的一个简单错误。虽然我的virtualenv内容在本地看起来很好,但我遇到了一个部署错误,导致了一些与我想要部署的内容不同的东西。现在,下一个错误:ImportError: cannot import name '_imaging'
https://stackoverflow.com/questions/46985397
复制相似问题