python/django - “Cannot use ImageField because Pillow is not installed”

后端 未结 11 1180
一向
一向 2021-01-17 11:38

I\'m joining a project, so I want to set up the environnment, so what I did is :

pip install -r requirements.txt

This fully installed all r

11条回答
  •  囚心锁ツ
    2021-01-17 11:58

    Had a similar problem, and my solution was much simpler:

    Apparently packages PIL and Pillow can't coexist. If you want to use Pillow you first have to uninstall PIL and then install Pillow.

    If you are on Mac, you have to install a few libraries as well using brew. Mentioned below is the sequence of steps:

    $pip uninstall PIL
    $brew install libtiff libjpeg webp little-cms2
    $pip install Pillow
    

    To test if pillow is installed and ready to use, open python interpreter and try to import the following:

    >>> from PIL import Image
    

    *note that the library still says PIL but now it is importing from Pillow instead of PIL.

    If you are able to successfully import then you are good to go (in all probability you won't have to worry about setting PYTHONPATH or 32/64-bit installations)

    Source: https://pillow.readthedocs.io/en/latest/installation.html

提交回复
热议问题