Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何为heroku和django准备FreeType PIL/枕头套装?_Python_Django_Heroku_Python Imaging Library_Pillow - Fatal编程技术网

Python 如何为heroku和django准备FreeType PIL/枕头套装?

Python 如何为heroku和django准备FreeType PIL/枕头套装?,python,django,heroku,python-imaging-library,pillow,Python,Django,Heroku,Python Imaging Library,Pillow,我知道这个问题可能被问了好几次,但到目前为止,没有一个答案是针对我的具体问题 我将在Heroku上部署一个django应用程序;它需要在图像上绘制一些文本,然后将其显示给用户。文本将使用意大利语,这意味着必须支持unicode 我遇到了几个问题: 要使用ttf字体,我需要在安装PIL/Pillow之前提供freetype库 ,当PIL绘制非ascii文本时,我得到一个UNICODEENCODEER错误 一个(或两个)问题的解决方案将解决我的问题: 如何使用FreeType支持在heroku

我知道这个问题可能被问了好几次,但到目前为止,没有一个答案是针对我的具体问题

我将在Heroku上部署一个django应用程序;它需要在图像上绘制一些文本,然后将其显示给用户。文本将使用意大利语,这意味着必须支持unicode

我遇到了几个问题:

  • 要使用ttf字体,我需要在安装PIL/Pillow之前提供freetype库
  • ,当PIL绘制非ascii文本时,我得到一个UNICODEENCODEER错误
一个(或两个)问题的解决方案将解决我的问题:

  • 如何使用FreeType支持在heroku上部署PIL/Pillow
  • 如何使用PIL字体绘制非ascii字符

非常感谢

您可以在heroku上的requirements.txt上使用此PIL fork,并提供FreeType支持:

-e git://github.com/errkk/gitpil.git#egg=PIL
Pillow==1.7.8

您可以在heroku上的requirements.txt上使用此PIL fork,并提供FreeType支持:

-e git://github.com/errkk/gitpil.git#egg=PIL
Pillow==1.7.8

感谢您的建议,但对我来说,它不起作用,setup.py显示“***FREETYPE2支持不可用”。正如Heroku django教程所建议的那样,我在virtual_env中。我错了,请使用上面的新答案重试。加载FreeType字体确实有效,但仍然无法完成图像加载。我得到一个“DecodeError:DecodeZip不可用”。这很奇怪,因为在pip安装期间,我得到了“--ZLIB(PNG/ZIP)支持”。有什么想法吗?现在我正在使用GIFs,这是这个奇怪的安装所支持的唯一格式…也许可以使用命令“heroku run pip uninstall PIL-PIL-pill-pill”卸载以前的PIL/pill,然后再次安装fork。感谢您的建议,但对我来说,它不起作用,setup.py显示“***FREETYPE2 support not available”。正如Heroku django教程所建议的那样,我在virtual_env中。我错了,请使用上面的新答案重试。加载FreeType字体确实有效,但仍然无法完成图像加载。我得到一个“DecodeError:DecodeZip不可用”。这很奇怪,因为在pip安装期间,我得到了“--ZLIB(PNG/ZIP)支持”。有什么想法吗?现在我正在使用GIFs,这是这个奇怪的安装所支持的唯一格式…也许可以使用命令“heroku run pip uninstall PIL-PIL-PIL-pill”卸载以前的PIL/Pillow,然后再次安装fork。