_imagingft c 模块未安装 amazon linux elasticbeanstalk
Posted
技术标签:
【中文标题】_imagingft c 模块未安装 amazon linux elasticbeanstalk【英文标题】:the _imagingft c module is not installed amazon linux elasticbeanstalk 【发布时间】:2021-11-21 03:31:29 【问题描述】:我在 AWS ElasticBeanstalk 上安装了我的应用程序,它最近开始出现以下错误:
_imagingft C 模块未安装
追溯:
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/rest_framework/views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/rest_framework/views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
raise exc
File "/opt/python/run/venv/local/lib/python3.6/site-packages/rest_framework/views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "/opt/python/current/app/grn/views.py", line 256, in get
a = ean.save(item['bar'], options=d)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/barcode/base.py", line 65, in save
output = self.render(options)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/barcode/codex.py", line 257, in render
return Barcode.render(self, options, text)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/barcode/base.py", line 105, in render
raw = self.writer.render(code)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/barcode/writer.py", line 227, in render
self._callbacks["paint_text"](xpos, ypos)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/barcode/writer.py", line 372, in _paint_text
font = ImageFont.truetype(self.font_path, self.font_size * 2)
File "/opt/python/run/venv/local/lib64/python3.6/site-packages/PIL/ImageFont.py", line 855, in truetype
return freetype(font)
File "/opt/python/run/venv/local/lib64/python3.6/site-packages/PIL/ImageFont.py", line 852, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/opt/python/run/venv/local/lib64/python3.6/site-packages/PIL/ImageFont.py", line 187, in __init__
if core.HAVE_RAQM:
File "/opt/python/run/venv/local/lib64/python3.6/site-packages/PIL/ImageFont.py", line 44, in __getattr__
raise ImportError("The _imagingft C module is not installed")
Exception Type: ImportError at /grn-print/
Exception Value: The _imagingft C module is not installed
在我的 requirements.py 中,我有以下模块:
asgiref==3.2.7
Django==3.0.5
django-cors-headers==3.2.1
djangorestframework==3.11.0
djangorestframework-simplejwt==4.4.0
PyJWT==1.7.1
pytz==2020.1
sqlparse==0.3.1
psycopg2==2.8.6
djangorestframework-jwt
django-storages
boto3==1.11.4
zplgrf
reportlab
pandas
python-barcode
pretty_html_table
folium
googlemaps
pyexcel
pyexcel_xls
openpyxl
gunicorn
Pillow==8.4.0
我发现使用freetype-devel
可能会有所帮助,但还是一样
01_packages.config
packages:
yum:
git: []
postgresql93-devel: []
libjpeg-turbo-devel: []
freetype-devel: []
libjpeg-turbo-devel: []
commands:
setuptools:
command: /opt/python/run/venv/bin/pip install setuptools --upgrade
我需要做什么才能完成这项工作?
【问题讨论】:
【参考方案1】:这与 Pillow 有关,缺少特定的依赖项。
也尝试添加这些包。
mesa-libGL-devel libjpeg-devel freetype-devel opencv-devel opencv-python
这家伙也有类似的问题:https://www.cocept.io/blog/development/using-pillow-on-amazon-elastic-beanstalk/
【讨论】:
我有packages: yum: git: [] postgresql93-devel: [] libjpeg-turbo-devel: [] freetype-devel: [] mesa-libGL-devel: []
但错误仍然存在以上是关于_imagingft c 模块未安装 amazon linux elasticbeanstalk的主要内容,如果未能解决你的问题,请参考以下文章
centos下安装pillow报ImportError: The _imagingft C module is not installed的解决方案
ImportError: The _imagingft C module is not installed
关于captcha使用The _imagingft C module is not installed的错误处理
如何修复“未安装 _imaging C 模块”Django/WSGI/Apache
Amazon Beanstalk CLI 错误:lib.utility,未找到模块
在 CDK 2.0.0 中访问 AWS SecretsManager:software.amazon.awscdk.services.secretsmanager.Secret 的错误在未命名的模块中