Tostring() 已被删除。请改用 tobytes()

Tostring() 已被删除。请改用 tobytes()

我尝试在我的 ubuntu 服务器上安装 Reddit 但在“make”行后出现错误。

请查看服务器的所有行。

[+] including definitions from Makefile.py
python setup.py build
Cannot find Baseplate. Skipping Thrift build.
running build
running build_py
running build_ext
python setup.py build_ext --inplace  # copy the .so files from cython into the source tree
Cannot find Baseplate. Skipping Thrift build.
running build_ext
copying build/lib.linux-x86_64-2.7/r2/lib/sgm.so -> r2/lib
copying build/lib.linux-x86_64-2.7/r2/lib/wrapped.so -> r2/lib
copying build/lib.linux-x86_64-2.7/r2/lib/db/_sorts.so -> r2/lib/db
copying build/lib.linux-x86_64-2.7/r2/lib/mr_tools/_mr_tools.so -> r2/lib/mr_tools
copying build/lib.linux-x86_64-2.7/r2/lib/utils/_utils.so -> r2/lib/utils
copying build/lib.linux-x86_64-2.7/r2/lib/utils/comment_tree_utils.so -> r2/lib/utils
copying build/lib.linux-x86_64-2.7/Cfilters.so -> 
# see above
rm -f build/public/static/sprite-reddit.png build/public/static/reddit.css
python r2/lib/nymph.py build/public/static/css/reddit.less build/public/static/sprite-reddit.png > build/public/static/css/reddit.less.tmp
Traceback (most recent call last):
  File "r2/lib/nymph.py", line 185, in <module>
    print spritify(sys.argv[1], sys.argv[2])
  File "r2/lib/nymph.py", line 178, in spritify
    images = _load_spritable_images(css_filename)
  File "r2/lib/nymph.py", line 94, in _load_spritable_images
    image_hash = hashlib.md5(image.convert("RGBA").tostring()).hexdigest()
  File "/usr/local/lib/python2.7/dist-packages/Pillow-3.2.0-py2.7-linux-x86_64.egg/PIL/Image.py", line 699, in tostring
    "Please call tobytes() instead.")
Exception: tostring() has been removed. Please call tobytes() instead.
make: *** [build/public/static/reddit.css] Error 1

这不是脚本的错误,因为我发现了一些类似的帖子,但对我来说并不适用。 https://www.reddit.com/r/redditdev/comments/19ntpk/make_fails_buildpublicstaticredditcss_error_127/https://www.reddit.com/comments/26dasw/_/

缺少了某些东西或设置错误,但我不知道是什么......请帮我修复它。

答案1

该代码需要比您现有的(3.2.0)更旧的 Pillow 版本(3.0 之前)。

尝试删除手动安装的 Pillow/usr/local/lib/python2.7/dist-packages/Pillow-3.2.0-py2.7-linux-x86_64.egg并安装旧版本。

相关内容